The four helper functions are separated and tested individually. I
want to test that hte public function calls all the helper functions.
I have done this in the past with code similar to the following.
[TestMethod]
public void InsertLogEntry_must_call_specific_methods()
{
ProductLogControl control;
ProductLog logEntry;
TreeNode node;
int position;
control = MockRepository.GenerateStrictMock<ProductLogControl>();
logEntry = new ProductLog ();
node = new TreeNode();
position = 0;
control.Expect(c => c.CreateHeader(logEntry)).Return(node);
control.Expect(c => c.AddTextNode(logEntry, node));
control.Expect(c => c.AddUserNode(logEntry, node));
control.Expect(c => c.InsertNode(node, position));
control. InsertLogEntry(logEntry, position);
control.VerifyAllExpectations();
}
I received an ExpectationViolationException that InsertLogEntry was
excepted #0, actual #1. I didn’t think non-virtual functions required
an Expect, but decided to stub the function anyway. Thus, I added the
following line.
control.Stub(c => c.AddTreeNodeLogEntry(logEntry,
position)).CallOriginalMethod(OriginalCallOptions.NoExpectation);
I then received an System.InvalidOperationException: “Proceed() is not
applicable to remoting mocks.” After A LOT OF SEARCHING I figured out
the issue is related to MarshalByRefObject and remoting mocks. I
found the one example that has been copied and pasted throughout the www.
I tried changing the allocation to the following.
control =
MockRepository.GenerateStrictMockWithRemoting<ProductLogControl>();
This did not fix my issue. From the one example I have found, I think
the this code should work. What step am I missing to get the remoting
mocks to work?
--
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.