0
votes

I have so far been coding by doing mostly Get methods in my business/service layer using Rhino Mocks to get an expected List or type and making Rhino Mocks return it for me, my question is how do I test a set/save call, e.g void SaveCustomers(Customer)

I have a call called GetCustomers, can I use Rhino mocks to call this immediately after my SaveCustomers call to see if it saved it into memory? I have tried this my mocking my repo and calling it but it returns a null, what is the correct syntax? I can't find an example using StrictMock or GenerateStub.

Thanks!

1

1 Answers

1
votes

If you're talking about using Rhino Mocks to mock the repository, you wouldn't need to get it to call GetCustomers, you can check it directly using syntax like this (using the 'AAA' style):

IMyRepository repository = MockRepository.GenerateMock<IMyRepository>();
// do stuff with repository
repository.AssertWasCalled(x => x.SaveCustomers(myTestCustomer));