public void LargestOf3Alt() { int[] numbers = new int[3]; numbers[0] = 8; numbers[1] = 9; numbers[2] = 7; Assert.That(Cmp.Largest(numbers), Is.EqualTo(9)); }
public void LargestOf3() { int[] numbers; numbers = new int[] { 9, 8, 7 }; Assert.That(Cmp.Largest(numbers), Is.EqualTo(9)); numbers = new int[] { 8, 9, 7 }; Assert.That(Cmp.Largest(numbers), Is.EqualTo(9)); numbers = new int[] { 7, 8, 9 }; Assert.That(Cmp.Largest(numbers), Is.EqualTo(9)); }
public void FromFile() { String line; StreamReader rdr = new StreamReader("../../testdata.txt"); while ((line = rdr.ReadLine()) != null) { if (isComment(line)) { continue; } int expected = getExpectedLargest(line); int[] args = getArguments(line); Assert.That(Cmp.Largest(args), Is.EqualTo(expected)); } }
public void FromFile() { string line; // most IDEs output binaries in bin/[Debug,Release] StreamReader reader = new StreamReader("../../testdata.txt"); while ((line = reader.ReadLine()) != null) { if (hasComment(line)) { continue; } int[] numbersForLine = getNumberList(line); int actualLargest = Cmp.Largest(numbersForLine); int expectedLargest = getLargestNumber(line); Assert.That(actualLargest, Is.EqualTo(expectedLargest)); } }
// [ExpectedException(typeof(ArgumentException))] public void Empty() { Cmp.Largest(new int[] {}); }
public void TestEmpty() { Assert.That(() => Cmp.Largest(new int[] { }), Throws.TypeOf <ArgumentException>()); }
public void TestNegative() { int[] negList = new int[] { -9, -8, -7 }; Assert.AreEqual(-7, Cmp.Largest(negList)); }
public void TestOne() { Assert.AreEqual(1, Cmp.Largest(new int[] { 1 })); }
public void TestDrugs() { Assert.AreEqual(0, Cmp.Largest(new int[] { 9, 7, 9, 8 })); }
public void LargestOf3() { Assert.AreEqual(9, Cmp.Largest(new int[] { 8, 9, 7 })); Assert.AreEqual(9, Cmp.Largest(new int[] { 7, 9, 8 })); Assert.AreEqual(9, Cmp.Largest(new int[] { 7, 8, 9 })); }