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, IEnumerable<TValue>> accessor, IEqualityComparer<TValue> comparer ) |
| Visual Basic (Declaration) |
|---|
Public Sub Add(Of TValue) ( _ accessor As Accessor(Of T, IEnumerable(Of TValue)), _ comparer As IEqualityComparer(Of TValue) _ ) |
Parameters
- accessor
- Type: Gallio.Common..::.Accessor<(Of <(T, IEnumerable<(Of <(TValue>)>)>)>)
An accessor that gets an enumeration of values from the tested object.
- comparer
- Type: System.Collections.Generic..::.IEqualityComparer<(Of <(TValue>)>)
A comparer instance for 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 enumerations of values returned by the accessor are compared one by one, by using the specified comparer.
Examples
public class Foo { public int[] Values; } [TestFixture] public class FooTest { [Test] public void MyTest() { var foo1 = new Foo() { Values = new int[] { 1, 2, 3, 4, 5 } }; var foo2 = new Foo() { Values = new int[] { 1, 2, 3, 4, 5 } }; Assert.AreEqual(foo1, foo2, new StructuralEqualityComparer<Foo> { { x => x.Values, new StructuralEqualityComparer<int> { { x => x } } }, }); } }
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentNullException | The specified accessor argument is a null reference. |
