Ejemplo n.º 1
0
        private static void TestDelegateWithArguments()
        {
            mCount = 0;
            Action <int> xDelegate = IncreaseCounter;

            xDelegate(2);
            Assert.AreEqual(2, mCount, "After calling delegate once, Count != 2");

            mCount = 0;
            var xTestInstance = new DelegatesTest();

            xDelegate = xTestInstance.IncreaseCounterFromInstanceMethod;
            xDelegate(3);
            Assert.AreEqual(3, mCount, "After calling delegate second time, Count != 3");
        }
Ejemplo n.º 2
0
        private static void TestDelegateWithoutArguments()
        {
            mCount = 0;
            Action xDelegate = IncreaseCounterOnce;

            xDelegate();
            Assert.AreEqual(1, mCount, "After calling delegate once, Count != 1");

            mCount = 0;
            var xTestInstance = new DelegatesTest();

            xDelegate = xTestInstance.IncreaseCounterTwiceFromInstanceMethod;
            xDelegate();
            Assert.AreEqual(2, mCount, "After calling delegate second time, Count != 2");
        }
Ejemplo n.º 3
0
 protected override void Run()
 {
     BranchStackCorruption();
     BranchStackCorruption2();
     DelegatesTest.Execute();
     try
     {
         ReturnTests.Execute();
         TestController.Completed();
     }
     catch (Exception E)
     {
         Console.WriteLine("Exception");
         Console.WriteLine(E.ToString());
     }
 }