When to use a Mocking Framework?

后端 未结 6 548
挽巷
挽巷 2021-01-02 18:52

So I am playing around with mocking frameworks (Moq) for my unit tests, and was wondering when you should use a mocking framework?

What is the benefit/disadvantage b

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-02 19:30

    Mock is used to test object that cannot function in isolation. suppose function A is dependent on function B, to perform unit testing on function A we even end up testing function B.By using mock you can simulate the functionality of function B and testing can be focussed only on function A.

提交回复
热议问题