Hi.
I'm performing an evaluation of JustMock and running through some simple cases. I'm finding the manual a bit light on examples and quickly running into cases which fail for reasons which I can't find explained anywhere.
How come in Test1 I have to arrange the property get but not the property set? It isn't a problem, just rather unintuitive and I don't see anywhere where this behaviour is explained. If I uncomment the commented out line it fails with:
Test 'M:Library1.Tests.Test3' failed: There were some problems intercepting the mock call. Optionally, please make sure that you have turned on JustMock's profiler while mocking concrete members.
Telerik.JustMock.MockException: There were some problems intercepting the mock call. Optionally, please make sure that you have turned on JustMock's profiler while mocking concrete members.
at Telerik.JustMock.Expectations.Expectation.ThrowForInvalidCall(IInvocation invocation)
at Telerik.JustMock.Expectations.Expectation.Process(IInvocation invocation)
at Telerik.JustMock.Mock.ArrangeSet(Action action)
Class1.cs(84,0): at Library1.Tests.Test3()
Why does Test2 fail if I don't mock the constructor? This might be a problem for me. This test is just noddy code but in real code one of my most desirable use cases is to be able to construct an object with various arguments and then mock some of its properties/methods while other properties/methods call the original implementation. If I uncomment the commented out line it fails with the same error as Test1.
I'm using JustMock 2012 SP1, assembly version 2012.1.229.0, 60 day trial version
Thanks.
I'm performing an evaluation of JustMock and running through some simple cases. I'm finding the manual a bit light on examples and quickly running into cases which fail for reasons which I can't find explained anywhere.
class
Fake1
{
public
Fake1(
int
a) { Prop1 = a; }
public
int
Prop1 {
get
;
set
; }
}
[Test]
public
void
Test1()
{
Fake1 f = Mock.Create<Fake1>(7);
// Mock.ArrangeSet(() => f.Prop1 = Arg.AnyInt).CallOriginal(); // FAILS
Mock.Arrange(() => f.Prop1).CallOriginal();
f.Prop1 = 5;
int
a = f.Prop1;
Assert.AreEqual(5, a);
}
[Test]
public
void
Test2()
{
// Fake1 f = Mock.Create<Fake1>(7); // FAILS
Fake1 f = Mock.Create<Fake1>(Constructor.Mocked);
int
intercepted = 0;
Mock.ArrangeSet(() => f.Prop1 = Arg.AnyInt).DoInstead((
int
x) => intercepted = x);
f.Prop1 = 5;
Assert.AreEqual(5, intercepted);
}
How come in Test1 I have to arrange the property get but not the property set? It isn't a problem, just rather unintuitive and I don't see anywhere where this behaviour is explained. If I uncomment the commented out line it fails with:
Test 'M:Library1.Tests.Test3' failed: There were some problems intercepting the mock call. Optionally, please make sure that you have turned on JustMock's profiler while mocking concrete members.
Telerik.JustMock.MockException: There were some problems intercepting the mock call. Optionally, please make sure that you have turned on JustMock's profiler while mocking concrete members.
at Telerik.JustMock.Expectations.Expectation.ThrowForInvalidCall(IInvocation invocation)
at Telerik.JustMock.Expectations.Expectation.Process(IInvocation invocation)
at Telerik.JustMock.Mock.ArrangeSet(Action action)
Class1.cs(84,0): at Library1.Tests.Test3()
Why does Test2 fail if I don't mock the constructor? This might be a problem for me. This test is just noddy code but in real code one of my most desirable use cases is to be able to construct an object with various arguments and then mock some of its properties/methods while other properties/methods call the original implementation. If I uncomment the commented out line it fails with the same error as Test1.
I'm using JustMock 2012 SP1, assembly version 2012.1.229.0, 60 day trial version
Thanks.