Rhino Mocks AssertWasCalled (multiple times) on property getter using AAA

前端 未结 6 1329
半阙折子戏
半阙折子戏 2020-12-30 18:20

I have a mocked object that is passed as a constructor argument to another object.

How can I test that a mocked object\'s property has been called? This is code I am

6条回答
  •  忘掉有多难
    2020-12-30 19:10

    newContact.AssertWasCalled(x => { var dummy = x.Forenames; }, options => options.Repeat.AtLeastOnce());

    Repeat.Any does not work with AssertWasCalled because 0 counts as any... so if it WASN'T called, the AsserWasCalled would return TRUE even if it wasn't called.

提交回复
热议问题