Is future mocking available in free version?

3 posts, 0 answers
  1. vsevolod
    vsevolod avatar
    2 posts
    Member since:
    Apr 2014

    Posted 03 Mar 2015 Link to this post

    Hello, I grabbed this example from docs and added virtual modifier to ReturnFive function because free version can't mock not virtual members.
    As far as I understand this modification shouldn't influence test results, though this test fails with  "Expected: 7  But was:  5"
    I can't find any explicit statement in docs about future mock feature support in free version, so I'm not sure if it's my fault or this feature is just not available.
    Any help would be appreciated.
    public class UserData
                public virtual int ReturnFive()
                    return 5;
            public void ShouldArrangeReturnForFutureUserDataInstances()
                // Arrange
                var fakeUsed = Mock.Create<UserData>();
                Mock.Arrange(() => fakeUsed.ReturnFive()).IgnoreInstance().Returns(7);

                // Assert
                Assert.AreEqual(7, fakeUsed.ReturnFive());
                Assert.AreEqual(7, new UserData().ReturnFive());
  2. Stefan
    Stefan avatar
    198 posts

    Posted 04 Mar 2015 Link to this post

    Hi Vsevolod,

    Future mocking is supported only in the commercial version. I checked the documentation and, indeed, the page is missing the note that states so. We'll update the documentation.

    In the free version, IgnoreInstance() is respected only for objects created using Mock.Create.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
  4. vsevolod
    vsevolod avatar
    2 posts
    Member since:
    Apr 2014

    Posted 04 Mar 2015 in reply to Stefan Link to this post

    Thank you for reply
Back to Top