Unit Testing Mock/Stub definitions in Moq

后端 未结 4 671
终归单人心
终归单人心 2021-02-07 16:12

Any reading or advice I\'ve been given on Unit Testing has always suggested a distinct difference between the definition of a Mock and a Stub. My current understanding of these

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-07 16:36

    According to the Moq project site, Moq provides:

    Granular control over mock behavior with a simple MockBehavior enumeration (no need to learn what's the theoretical difference between a mock, a stub, a fake, a dynamic mock, etc.)

    The lack of distinction between mocks, stubs, and such is a deliberate design decision; A design decision which I, for one, prefer. If I need a true mock, I call Verify() on it. If not, there's no Verify(). I like the simplicity, and I haven't found myself missing the distinction between mock and stub.

提交回复
热议问题