Ordering method return values with Rhino-Mock stubs

后端 未结 2 1452
面向向阳花
面向向阳花 2021-01-04 23:24

I\'ve started experimenting with Rhino-Mocks (3.6) while reading Roy Osherove\'s The Art of Unit Testing. He has an example that demonstrates that a mocked method

2条回答
  •  猫巷女王i
    2021-01-05 00:18

    I think if you are working with stubs, using Expect does not fit as you do not want an expectation but a replacement for your dependency.

    So I believe if you use the stub syntax it makes more sense:

    stub.Stub.(s=>s.GetMessageForValue("a"))
                                .Return("First call").Repeat.Once(); 
    
    stub.Stub.(s=>s.GetMessageForValue("a"))
                                .Return("Second call").Repeat.Any;
    

提交回复
热议问题