I am currently writing an application and checking its correct behavior. I need to check if methods are called in the given order.
For my unit tests I use xUnit and Moq
Now, why should I check the order in which calls are made?
I am developing a solution that performs tasks for different threads. As soon as the task is completed, I write a message to the specified registrar, therefore, checking the order in which the registrar calls, I am sure that my code was correctly implemented.
See here the code I'm trying to use:
public class SchedulerFixture {
So, the first step in my testing is to configure the logs, then the test itself is performed (this causes calls to the registrar), and in the end I check it.
However, the test always passes.
In this case, it should fail because the following call:
LoggerMock.InSequence(sequence).Setup(x => x.Information("émqsdlfk", "smdlfksdmlfk")).Verifiable();
Not executed anywhere in my code.
source share