Hi all,

I have the following test:

        [TestMethod]
        public void Save_command_should_save_current_appointment()
        {
            var view =
MockRepository.GenerateStub<IAppointmentEditView>();
            var editingController =
MockRepository.GenerateStub<IEditingController>();
            var dataService =
MockRepository.GenerateMock<IAppointmentDataService>();
            var viewModel =
MockRepository.GenerateStub<AppointmentEditViewModel>(view,
editingController, dataService);

            var appointment = new AppointmentItem();
            viewModel.Appointment = appointment;

            viewModel.SaveCommand.Execute(null);

            dataService.AssertWasCalled(ds => ds.SaveAppointment(Arg.Is
(appointment)));
        }

the test passes, but there's one thing that bothers me: I want to stub
out the viewModel.Appointment property, because its setter has some
logic that I don't want to run in this test. I tried doing something
like this:

viewModel.Stub(x => x.Appointment).Return(appointment);

but then my test fail at that line, with the following error:

"This action is invalid when the mock object is in replay state."

Am I missing something there?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to