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<TValue>(
	Accessor<T, TValue> accessor
)
Visual Basic (Declaration)
Public Sub Add(Of TValue) ( _
	accessor As Accessor(Of T, TValue) _
)

Parameters

accessor
Type: Gallio.Common..::.Accessor<(Of <(T, TValue>)>)
An accessor that gets a value from the tested object.

Type Parameters

TValue
The type of the value returned by the accessor.

Remarks

The values returned by the accessor are compared by using a default comparison evaluator.

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 => x.Value },
        });
    }
}

Exceptions

ExceptionCondition
System..::.ArgumentNullExceptionThe specified accessor argument is a null reference.

See Also