If I'm have a class as a parameter to a mocked method, what does JustMock use to determine whether the parameters match or not?
e.g.
No matter what I do, I can't seem to get the BI parameter to match correctly.
I've tried Equals and a bunch of the interfaces for testing equality and none seem to get called.
Do I need to use the Arg.Matches or should this work and I'm just missing something?
e.g.
public class Bi
{
protected bool Equals(Bi other)
{
return I == other.I;
}
public override int GetHashCode()
{
return I;
}
public override bool Equals(object obj)
{
return base.Equals(obj);
}
public int I { get; set; }
}
public interface IR
{
bool Get(Bi bi);
}
public class G
{
private readonly IR _r;
public G(IR r)
{
_r = r;
}
public bool M()
{
var bi = new Bi {I = 1};
return _r.Get(bi);
}
}
[TestFixture]
public class Test
{
[Test]
public void Test1()
{
var bi = new Bi {I = 1};
var r = Mock.Create<
IR
>();
Mock.Arrange(() => r.Get(bi)).Returns(true);
var g = new G(r);
var b = g.M();
Assert.That(b, Is.True);
}
}
I've tried Equals and a bunch of the interfaces for testing equality and none seem to get called.
Do I need to use the Arg.Matches or should this work and I'm just missing something?