static void Succeed <TData>( Func <TData, IndexValuePair>[] operators, TData data, IndexValuePair expected) where TData : class { for (int i = 0; i < operators.Length; i++) { var actual = operators[i](data); IndexValuePairAssert.AreEqual( expected: expected, actual: actual, delta: DoubleMatrixTest.Accuracy); } }
/// <summary> /// Asserts that the specified arrays of /// <see cref="IndexValuePair"/> instances are equal. /// </summary> /// <param name="expected">The expected array.</param> /// <param name="actual">The actual array.</param> /// <param name="delta">The required accuracy.</param> /// <exception cref="AssertFailedException"> /// One array is null, the other is not.</br> /// -or-</br> /// The arrays have not the same length.</br> /// -or-</br> /// A value is unexpected at a given position.</br> /// -or-</br> /// An index is unexpected at a given position.</br> /// </exception> public static void AreEqual( IndexValuePair[] expected, IndexValuePair[] actual, double delta) { if (null == expected && null == actual) { return; } if (((null == expected) && (null != actual)) || ((null != expected) && (null == actual))) { throw new AssertFailedException( "One IndexValuePair[] instance is null, the other is not."); } int expectedLength = expected.Length; int actualLength = actual.Length; if (expectedLength != actualLength) { throw new AssertFailedException( "IndexValuePair[] instances have not the same length."); } // IndexValuePair states for (int i = 0; i < actual.Length; i++) { IndexValuePairAssert.AreEqual( expected[i], actual[i], delta, string.Format("at position {0}.", i)); } }