This is a migrated thread and some comments may be shown as answers.

Is future mocking available in free version?

2 Answers 23 Views
JustMock Free Edition
This is a migrated thread and some comments may be shown as answers.
vsevolod
Top achievements
Rank 1
vsevolod asked on 03 Mar 2015, 09:13 AM
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;
            }
        }
        [Test]
        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 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 04 Mar 2015, 07:08 AM
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.

Regards,
Stefan
Telerik
 

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.

 
0
vsevolod
Top achievements
Rank 1
answered on 04 Mar 2015, 09:39 AM
Thank you for reply
Tags
JustMock Free Edition
Asked by
vsevolod
Top achievements
Rank 1
Answers by
Stefan
Telerik team
vsevolod
Top achievements
Rank 1
Share this question
or