public void GetPairWithIncreasingOrderMaximumDifference_TakesFuncIntoAccount() { var result = Pairing.GetPairWithIncreasingOrderMaximumDifference(new[] { 0, -10, 10, -11 }, (l, r) => Math.Abs(l - r)); Assert.AreEqual((0, -11), result); }
public void GetPairWithIncreasingOrderMaximumDifference_ThrowsException_ForNullSequence() { Assert.Throws <ArgumentNullException>( () => Pairing.GetPairWithIncreasingOrderMaximumDifference((int[])null, Subtract)); }
public void GetPairWithIncreasingOrderMaximumDifference_ThrowsException_ForNullFunc() { Assert.Throws <ArgumentNullException>( () => Pairing.GetPairWithIncreasingOrderMaximumDifference(new int[] { }, null)); }
public void GetPairWithIncreasingOrderMaximumDifference_ReturnsThePair_ForTwoIncreasingElements() { var result = Pairing.GetPairWithIncreasingOrderMaximumDifference(new[] { 1, 2 }, Subtract); Assert.AreEqual((1, 2), result); }
public void GetPairWithIncreasingOrderMaximumDifference_ReturnsNull_ForTwoDecreasingElements() { var result = Pairing.GetPairWithIncreasingOrderMaximumDifference(new[] { 2, 1 }, Subtract); Assert.IsNull(result); }
public void GetPairWithIncreasingOrderMaximumDifference_ReturnsNull_ForEmptySequence() { var result = Pairing.GetPairWithIncreasingOrderMaximumDifference(new int[] { }, Subtract); Assert.IsNull(result); }
public void GetPairWithIncreasingOrderMaximumDifference_WorksInterruptedSequence_3() { var result = Pairing.GetPairWithIncreasingOrderMaximumDifference(new[] { 10, 20, 8, 19, 7, 19, 6 }, Subtract); Assert.AreEqual((7, 19), result); }
public void GetPairWithIncreasingOrderMaximumDifference_WorksForPerfectSequenceOfThree() { var result = Pairing.GetPairWithIncreasingOrderMaximumDifference(new[] { 0, 1, 2 }, Subtract); Assert.AreEqual((0, 2), result); }
public void GetPairWithIncreasingOrderMaximumDifference_WorksForNegative() { var result = Pairing.GetPairWithIncreasingOrderMaximumDifference(new[] { 0, -100, 100 }, Subtract); Assert.AreEqual((0, 100), result); }