Can someone explain to me why the .Stub version of the following code
does not work, but the .Expect version does? If you need more
clarification as to various parts of the code, I can explain further,
but hopefully this should be enough:
Doesn't work:
var jobParameterList = new SortedList{{"PKEY", "50"}};
var stubbedJobQueue = MockRepository.GenerateStub<IJobQueue>();
stubbedJobQueue.Stub(x => x.AddNewJobQueueRow(4, jobParameterList));
var mainProcessing = new MainProcessing();
mainProcessing.CreateJobQueueForCustomer(stubbedJobQueue);
stubbedJobQueue.AssertWasCalled(x =>
x.AddNewJobQueueRow(Arg<int>.Matches(i => i.Equals(4)),
Arg<SortedList>.Matches(list => list.ContainsKey("PKEY") &&
list.ContainsValue("50"))));
Does work:
var jobParameterList = new SortedList{{"PKEY", "50"}};
var stubbedJobQueue = MockRepository.GenerateStub<IJobQueue>();
stubbedJobQueue.Expect(x => x.AddNewJobQueueRow(Arg<int>.Matches(i =>
i.Equals(4)),
Arg<SortedList>.Matches(list => list.ContainsKey("PKEY") &&
list.ContainsValue("50"))));
var mainProcessing = new MainProcessing();
mainProcessing.CreateJobQueueForCustomer(stubbedJobQueue);
stubbedJobQueue.VerifyAllExpectations();
--
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.