开发者

Using Moq how do you verify function was called without specifying parameters?

开发者 https://www.devze.com 2023-03-01 14:22 出处:网络
Sometimes I want to just verify that a function was called rather than have to test the function was called with specific parameters.

Sometimes I want to just verify that a function was called rather than have to test the function was called with specific parameters.

The reason for this that there is a complex object being passed in as a parameter, but the later call inside that function makes a database fetch. Since this will be mocked, it will just have nulls & 0s.

I just wa开发者_如何学Cnt to verify the call without testing against the passed in parameters. How can I do this?


You may find the following blog post useful. Quote:

myMockedClass.Verify(
    x => x.Connect(It.IsAny<MyArgumentType>())
);
0

精彩评论

暂无评论...
验证码 换一张
取 消