Adds a matching criterion to the structural equality comparer.

Namespace:  MbUnit.Framework
Assembly:  MbUnit (in MbUnit.dll) Version: 3.3.0.0 (3.3.610.0)

Syntax

C#
public void Add(
	EqualityComparison<T> comparer
)
Visual Basic (Declaration)
Public Sub Add ( _
	comparer As EqualityComparison(Of T) _
)

Parameters

comparer
Type: Gallio.Common..::.EqualityComparison<(Of <(T>)>)
An equality comparison delegate to directly compare two instances, or null to use the default one.

Remarks

The evaluation process is done through the specified comparison delegate.

Examples

CopyC#
public class Foo
{
    public int Value;
}

[TestFixture]
public class FooTest
{
    [Test]
    public void MyTest()
    {
        var foo1 = new Foo() { Value = 123 };    
        var foo2 = new Foo() { Value = 123 };

        Assert.AreEqual(foo1, foo2, new StructuralEqualityComparer<Foo>
        {
            { (x, y) => x.Value == y.Value },
        });
    }
}

See Also