10 Answers, 1 is accepted
Thanks that you have asked. By default the ordering is override. In order to apply sequence you need to apply the "InSequece" modifier in your setup.
I made a post earlier on this , you might like to take a look:
Thanks again for the detailed example. Here the issue is that you have different types of call and you marked them to be in sequence.
"InSequence" works for cases where you have multiple setups with similar call and with same arguments, like for example:
Now, if you don't specify the sequential modifier, JustMock will always consider the last setup [Incase of simialr call]:
Finally, Mock.Assert verifies if all your required calls have been invoked successfully regardless of the sequence.
Hope that helps,
It’s nice to hear that you made it work for you. Also, I am putting the feature mentioned by you into our backlog with the following title:
Support of extending InSequece() modifier to ensure the correct order of any method call through Mock.Assert() .
Hopefully, it will be available in one of the upcoming builds.
I need to ensure that certain methods are called in a certain order. Not just that they are called.
To achieve this, you can use "InOrder()", like this:
Note that, if you change the order of the method calls or the arrangements, the test will fail.
I hope this helps.
the Telerik team
Using the technique you suggested, I must order my test like this
//Arrange (initial conditions)
// setup expected results (ordering)
What I would prefer is
// Assert (expected results in order)
But using InOrder in Mock.Arrange is perfectly workable.
I am glad, this works for you.
However, thank you for the feedback and the great idea. We will definitely take it into consideration.
the Telerik team