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

Assert calls DoInsert implicitly

1 Answer 12 Views
JustMock Free Edition
This is a migrated thread and some comments may be shown as answers.
Isaac Abraham
Top achievements
Rank 1
Isaac Abraham asked on 25 Apr 2013, 04:08 PM
I have a mock and have set up a call to DoInstead on it, something like this: -

Mock.Arrange(() => myService.Foo(Arg.AnyGuid))
   .DoInstead(new System.Action<System.Guid>(Console.WriteLine));

Later on in my test, I call an Assert on that same method: -

Mock.Assert(() => myService.Foo(Arg.AnyGuid), Occurs.Once());

When it hits the Assert line, my DoInstead handler suddenly gets fired. It's as if the Assertion is actually called the mock method like my production code has. Even worse, if I put a Match on the Arrange call e.g.

myService.Foo(Arg.Matches<Guid>(g => g != Guid.Empty))

but this is completely ignored and it still falls into the Console.WriteLine call.

At any rate, calls to Assert should not implicitly call DoInstead handlers that have already been set up.

1 Answer, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 30 Apr 2013, 08:14 AM
Hi Isaac,

Thank you for reporting these issues.

Our development team is currently working on them. Fixes should be expected in one of the JustMock near future releases.

For reporting a critical bug, we have granted you some Telerik points.

Kind regards,
Kaloyan
the Telerik team
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
Tags
JustMock Free Edition
Asked by
Isaac Abraham
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Share this question
or