Using Moq to verify calls are made in the correct order

后端 未结 8 1697
青春惊慌失措
青春惊慌失措 2020-12-01 10:00

I need to test the following method:

CreateOutput(IWriter writer)
{
    writer.Write(type);
    writer.Write(id);
    writer.Write(sender);

    // many more         


        
8条回答
  •  半阙折子戏
    2020-12-01 10:34

    I suspect that expectedId is not what you expect.

    However i'd probably just write my own implementation of IWriter to verify in this case ... probably a lot easier (and easier to change later).

    Sorry for no Moq advice directly. I love it, but haven't done this in it.

    do you maybe need to add .Verify() at the end of each setup? (That really is a guess though i'm afraid).

提交回复
热议问题