public void TestSetNum()
        {
            GenericDelegate.setNumber(10);
            int expectNum = GenericDelegate.getNum();

            Assert.AreEqual(10, expectNum);
        }
Exemple #2
0
        public void Run()
        {
            //create delegate instances
            NumberChanger <int> nc1 = new NumberChanger <int>(GenericDelegate.AddNum);
            NumberChanger <int> nc2 = new NumberChanger <int>(GenericDelegate.MultNum);

            //calling the methods using the delegate objects
            nc1(25);
            Console.WriteLine("Value of Num: {0}", GenericDelegate.getNum());

            nc2(5);
            Console.WriteLine("Value of Num: {0}", GenericDelegate.getNum());

            Console.WriteLine("\n");
        }
        public void TestGetNum()
        {
            int expectNum = GenericDelegate.getNum();

            Assert.AreEqual(10, expectNum);
        }