public void MyTestMethod() { var target = new IntToggleProblems(); var a = new int[] { 0, 1, 2, 3 }; var ex = new int[] { 0, 2, 1, 3 }; var a2 = new int[] { 2, 1, 3, 0 }; var ex2 = new int[] { 1, 3, 0, 2 }; target.Transform(a); target.Transform(a2); CollectionAssert.AreEqual(ex, a); CollectionAssert.AreEqual(ex2, a2); }
public void MyTestMethod2() { Random rand = new Random(); var a = RandomNumberStream(rand).Take(101).ToArray(); var target = new IntToggleProblems(); target.Transform(a); for (int i = 0; i < a.Length - 1; i++) { if (i % 2 == 0) { Assert.IsTrue(a[i] < a[i + 1]); } else { Assert.IsTrue(a[i] > a[i + 1]); } } }