开发者

How to unit test a method with void return type?

开发者 https://www.devze.com 2023-02-10 13:03 出处:网络
How do you write a unit test for a method with void ret开发者_如何学Pythonurn type?Assuming the method does something, you can try to sense that something.

How do you write a unit test for a method with void ret开发者_如何学Pythonurn type?


Assuming the method does something, you can try to sense that something.

That is, suppose it increments a variable that is exposed elsewhere in a property - you can check the value of the property before and after calling the method.

In essence this is checking that the method is working correctly by checking the expected side-effects from it.

0

精彩评论

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