I was trying to perform subsequent calls verification and I found that moq supports the InSequence() method for this, like:
MockSequence s = new MockSequence();
validator.InSequence(s).Setup(m => m.IsValid(It.IsAny<Frame>())).Returns(true);
encryptor.InSequence(s).Setup(m=>m.Encrypt(It.IsAny<Frame>()));
socket.InSequence(s).Setup(m => m.Send(It.IsAny<Frame>()));
compressor.InSequence(s).Setup(m => m.Compress(It.IsAny<Frame>()));
However, this seems to be working only when I specify mock behavior as "strict", which forbids me calling additional mehods on mocked objects. I'd like, however, to be able to call other methods on those objects, I just want THESE calls to be performed in sequence.
Is there any "supported" way for that (instead of resorting to .Callback() and handmade implementation)? I found an additional library called moq.sequence, however, the precompiled version doesn't work with latest Moq.