Adds a matching criterion to the structural equality comparer.
Namespace:
MbUnit.FrameworkAssembly: MbUnit (in MbUnit.dll) Version: 3.3.0.0 (3.3.610.0)
Syntax
| C# |
|---|
public void Add<TValue>( Accessor<T, TValue> accessor, EqualityComparison<TValue> comparer ) |
| Visual Basic (Declaration) |
|---|
Public Sub Add(Of TValue) ( _ accessor As Accessor(Of T, TValue), _ comparer As EqualityComparison(Of TValue) _ ) |
Parameters
- accessor
- Type: Gallio.Common..::.Accessor<(Of <(T, TValue>)>)
An accessor that gets a value from the tested object.
- comparer
- Type: Gallio.Common..::.EqualityComparison<(Of <(TValue>)>)
A equality comparison delegate to compare the values returned by the accessor, or null to use the default one.
Type Parameters
- TValue
- The type of the value returned by the accessor.
Remarks
The values returned by the accessor are compared by using the specified comparison delegate.
Examples
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, (x, y) => x == y }, }); } }
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentNullException | The specified accessor argument is a null reference. |
