Ejemplo n.º 1
0
        public void MixWeak_Test()
        {
            DelegateProves delegateProves = new DelegateProves();
            WeakDelegate   weakDelegate   = new WeakDelegate((Action <int, string, int>)(delegateProves.ProveMix));

            eventMixTest += (Action <int, string, int>)weakDelegate;
            eventMixTest.Invoke(4, " = ", 4);
            Assert.AreEqual(delegateProves.GetProveMix, "4 = 4");
        }
Ejemplo n.º 2
0
        public void StringWeak_Test()
        {
            DelegateProves delegateProves = new DelegateProves();
            WeakDelegate   weakDelegate   = new WeakDelegate((Action <string, string, string>)(delegateProves.ProveString));

            eventStringTest += (Action <string, string, string>)weakDelegate;
            eventStringTest.Invoke("a", "b", "c");
            Assert.AreEqual(delegateProves.GetProveString, "abc");
        }
Ejemplo n.º 3
0
        public void DoubleWeak_Test()
        {
            DelegateProves delegateProves = new DelegateProves();
            WeakDelegate   weakDelegate   = new WeakDelegate((Action <double>)(delegateProves.ProveDouble));

            eventFloatTest += (Action <double>)weakDelegate;
            eventFloatTest.Invoke(4.7);
            Assert.AreEqual(delegateProves.GetProveDouble, 4.7);
        }
Ejemplo n.º 4
0
        public void IntWeak_Test()
        {
            DelegateProves delegateProves = new DelegateProves();
            WeakDelegate   weakDelegate   = new WeakDelegate((Action <int, int>)(delegateProves.ProveInt));

            eventIntTest += (Action <int, int>)weakDelegate;
            eventIntTest.Invoke(5, 8);
            Assert.AreEqual(delegateProves.GetProveInt, 40);
        }