Hi Robert,
Thank you for contacting our support.
To answer your question, I'll use the following system under test for example:
To assert occurrence against a certain static arrangement, you can choose one of the following approaches:
In the first example, we will arrange that a specific static method should occur once and in the same time return true, no matter its arguments. Then we will act by calling the
IsRequestAuthenticate
method with "test" as an argument. To assert the occurrence, we need to use Mock.Assert. However, as we want to check for all method calls, we will also need ignore the method arguments in the assert:
If the above
Args.Ignore() is not specified, the test will fail. This is so, because the assert will expect that the
IsRequestAuthenticate
method is called once with
null as an argument. This is shown in the next example in which you assert only against an argument specific call:
Further, I removed the IgnoreInstance() from you arrangement, as it is not needed. This is so, because you are arranging against static member.
I hope the above helps. Let me know if there is more I can help you with.
Regards,
Kaloyan
Telerik
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.