Esempio n. 1
0
        static void Main(string[] args)
        {
            //GetMax gm = delegate (int a, int b) {
            //    return a > b ? a : b;
            //};

            GetMax gm = (int a, int b) => a > b ? a : b;

            System.Console.WriteLine(gm(6, 9));

            Console.ReadKey();
        }
Esempio n. 2
0
        public void GetMaxInArrayTest()
        {
            GetMax getMax = new GetMax();

            double[] score1 = { 88.5, 95, 86, 99, 98 };
            double[] score2 = { 88.5, 95, 100, 99, 98 };
            double[] score3 = { 88.5, 95, 86, 66, 98 };
            double[] score4 = { 0, 95, 86, 99, 98 };

            Assert.AreEqual(getMax.GetMaxInArray(score1), 99);
            Assert.AreEqual(getMax.GetMaxInArray(score2), 100);
            Assert.AreEqual(getMax.GetMaxInArray(score3), 98);
            Assert.AreEqual(getMax.GetMaxInArray(score4), 99);
        }