I’m having a really hard time trying to figure how I can do .SetupXXX() calls on the underlying Mock<T> that has been generated inside the MockingKernel. Anyone who can shed some light on how it is supposed to work?
I’m having a really hard time trying to figure how I can do .SetupXXX()
Share
You need to call the
GetMock<T>method on theMoqMockingKernelwhich will return the generatedMock<T>on which you can call your.SetupXXX()/VerifyXXX()methods.Here is an example unit test which demonstrates the
GetMock<T>usage:Where the involved types are the following:
Note that you can access the generated
Moq.MockRepository(if you prefer it over the SetupXXX methods) with theMoqMockingKernel.MockRepositoryproperty.