public void TestMethod() { // TODO: Add your test code here Assert.AreEqual(9, Class1.largest(new int[] { 8, 9, 7 })); Assert.AreEqual(9, Class1.largest(new int[] { 7, 8, 9 })); Assert.AreEqual(9, Class1.largest(new int[] { 9 })); Assert.AreEqual(-7, Class1.largest(new int[] { -7, -8, -9 })); Assert.That(() => Class1.largest(new int[] { }), Throws.TypeOf <ArgumentException>()); }
static void Main(string[] args) { int[] num = new int[] { 8, 9, 7 }; Console.Write("number:"); foreach (int a in num) { Console.Write(a.ToString() + " "); } Console.Write("\r\n" + "largest:" + Class1.largest(num)); Console.Read(); }