Hi,

I have a simple abstract class where a redefine the Equals method:

abstract class MyBaseEntity
{
    protected MyBaseEntity( Object value ){ …. }

    public override bool Equals( object obj )
    {
        //My own equality logic
    }
}

If I try to test it using PartialMock<T> my implementation never gets
called… the only way is to mark Equals override as sealed.
A very trivial sample:

[TestMethod()]
public void equalsTest()
{
    var mocks = new MockRepository();

    var obj = new Object();
    var entity1 = mocks.PartialMock<MyBaseEntity>( obj );
    var entity2 = mocks.PartialMock<MyBaseEntity>( obj );

    var actual = entity1.Equals( entity2 );

    Assert.IsTrue( actual );
}

In this case, that is only a sample to explain the behavior, actual is
false, but should be true due to the Equals override, placing a
breakpoint in my Equals implementation highlight that it is never
called. Marking it as sealed works as expected.

Is this an expected behavior? Am I doing something wrong?

TIA, best regards
.m
--~--~---------~--~----~------------~-------~--~----~
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