When to use mocking versus faking in C# unit testing?

前端 未结 4 827
别那么骄傲
别那么骄傲 2020-12-22 17:34

Can anyone come up with guidelines suggesting the ideal scenarios to choose mocking versus faking, i.e., setting up the essentials manually?

I am a bit confused wit

4条回答
  •  庸人自扰
    2020-12-22 18:05

    The Little Mocker, from Bob Martin, is a very good reading on the topic.

    [...] long ago some very smart people wrote a paper that introduced and defined the term Mock Object. Lots of other people read it and started using that term. Other people, who hadn't read the paper, heard the term and started using it with a broader meaning. They even turned the word into a verb. They'd say, "Let's mock that object out.", or "We've got a lot of mocking to do."

    The article explains the differences between mocks, fakes, spys and stubs.

提交回复
热议问题