Hello,

I just experienced some different behavior of DynamicMultiMock and
DynamicMock mocks in RhinoMocks V3.6 that I do not understand for now.

I have a class A.  It is an abstract base class and has a method
CopyFrom() that takes an instance of A as argument. It calls some
properties of the passed instance of A and sets it on the current
instance:

internal abstract class A
{
  internal string PropertyA { get; set; }

  public void CopyFrom(A a)
  {
    PropertyA = a.PropertyA;
  }

  protected internal A(A a)
  {
    CopyFrom(a);
  }
}


Additionally I have a class B that inherits from A and that is the
subject under test. (Class B always calls the protected constructor of
class A when being constructed.)


So when I want to mock class A to test B, then in case

a) I use a DynamicMock, I have to set an expectation on the request of
that non-abstract property.

Whereas when

b) I use a DynamicMultiMock, I must not set such expectation as
otherwise I get an System.InvalidOperationException : Invalid call,
the last call has been used or no call has been made

Additionally, when

c) I use StrictMultiMock, I must not set such expectation, too. What
me wonders is that when I use StrictMock, then I have to set that
expectation.


So for now I assume that the implementation for DynamicMock and
DynamicMultiMock differs - although it should not differ related to
that situation in my eyes.

But maybe I'm wrong, so if someone could point me in the right
direction that would be great.

Thanks,
Ralf

-- 
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