Beispiel #1
0
        public void TestCacheablePocoSubtractAssign()
        {
            var  tPoco  = new PocoEvent();
            bool tTest  = false;
            var  tEvent = new EventHandler <EventArgs>((@object, args) => { tTest = true; });

            var tCachedInvoke = new CacheableInvocation(InvocationKind.SubtractAssign, "Event");

            tPoco.Event += tEvent;

            tCachedInvoke.Invoke(tPoco, tEvent);

            tPoco.OnEvent(null, null);

            Assert.AreEqual(false, tTest);

            tCachedInvoke.Invoke(tPoco, tEvent);//Test Second Time

            var tPoco2 = new PropPoco()
            {
                Event = 3
            };

            tCachedInvoke.Invoke(tPoco2, 4);

            Assert.AreEqual(-1, tPoco2.Event);
        }
Beispiel #2
0
        public void TestPocoSubtractAssign()
        {
            var  tPoco  = new PocoEvent();
            bool tTest  = false;
            var  tEvent = new EventHandler <EventArgs>((@object, args) => { tTest = true; });

            tPoco.Event += tEvent;

            Dynamic.InvokeSubtractAssignMember(tPoco, "Event", tEvent);

            tPoco.OnEvent(null, null);

            Assert.AreEqual(false, tTest);

            Dynamic.InvokeSubtractAssignMember(tPoco, "Event", tEvent);//Test Second Time

            var tPoco2 = new PropPoco()
            {
                Prop2 = 3
            };

            Dynamic.InvokeSubtractAssignMember(tPoco2, "Prop2", 4);

            Assert.AreEqual(-1L, tPoco2.Prop2);
        }
Beispiel #3
0
        public void TestPocoAddAssign()
        {
            var  tPoco = new PocoEvent();
            bool tTest = false;

            Dynamic.InvokeAddAssignMember(tPoco, "Event", new EventHandler <EventArgs>((@object, args) => { tTest = true; }));

            tPoco.OnEvent(null, null);

            Assert.AreEqual(true, tTest);

            var tPoco2 = new PropPoco()
            {
                Prop2 = 3
            };

            Dynamic.InvokeAddAssignMember(tPoco2, "Prop2", 4);

            Assert.AreEqual(7L, tPoco2.Prop2);
        }
Beispiel #4
0
        public void TestCacheablePocoAddAssign()
        {
            var  tPoco = new PocoEvent();
            bool tTest = false;

            var tCachedInvoke = new CacheableInvocation(InvocationKind.AddAssign, "Event");

            tCachedInvoke.Invoke(tPoco, new EventHandler <EventArgs>((@object, args) => { tTest = true; }));

            tPoco.OnEvent(null, null);

            Assert.AreEqual(true, tTest);

            var tPoco2 = new PropPoco()
            {
                Event = 3
            };

            tCachedInvoke.Invoke(tPoco2, 4);

            Assert.AreEqual(7L, tPoco2.Event);
        }
         public void TestCacheablePocoSubtractAssign()
         {
             var tPoco = new PocoEvent();
             bool tTest = false;
             var tEvent = new EventHandler<EventArgs>((@object, args) => { tTest = true; });

             var tCachedInvoke = new CacheableInvocation(InvocationKind.SubtractAssign, "Event");

             tPoco.Event += tEvent;

             tCachedInvoke.Invoke(tPoco, tEvent);

             tPoco.OnEvent(null, null);

             Assert.AreEqual(false, tTest);

             tCachedInvoke.Invoke(tPoco, tEvent);//Test Second Time

             var tPoco2 = new PropPoco() { Event = 3 };

             tCachedInvoke.Invoke(tPoco2, 4);

             Assert.AreEqual(-1, tPoco2.Event);
         }
         public void TestPocoSubtractAssign()
         {
             var tPoco = new PocoEvent();
             bool tTest = false;
             var tEvent = new EventHandler<EventArgs>((@object, args) => { tTest = true; });

             tPoco.Event += tEvent;

             Impromptu.InvokeSubtractAssignMember(tPoco, "Event", tEvent);

             tPoco.OnEvent(null, null);

             Assert.AreEqual(false, tTest);

             Impromptu.InvokeSubtractAssignMember(tPoco, "Event", tEvent);//Test Second Time

             var tPoco2 = new PropPoco() {Prop2 = 3};

             Impromptu.InvokeSubtractAssignMember(tPoco2, "Prop2", 4);

             Assert.AreEqual( -1L,tPoco2.Prop2);
         }
         public void TestCacheablePocoAddAssign()
         {
             var tPoco = new PocoEvent();
             bool tTest = false;

             var tCachedInvoke = new CacheableInvocation(InvocationKind.AddAssign, "Event");

             tCachedInvoke.Invoke(tPoco, new EventHandler<EventArgs>((@object, args) => { tTest = true; }));

             tPoco.OnEvent(null, null);

             Assert.AreEqual(true, tTest);

             var tPoco2 = new PropPoco() { Event = 3 };

             tCachedInvoke.Invoke(tPoco2, 4);

             Assert.AreEqual(7L, tPoco2.Event);
         }
         public void TestPocoAddAssign()
         {
             var tPoco = new PocoEvent();
             bool tTest = false;

             Impromptu.InvokeAddAssignMember(tPoco, "Event", new EventHandler<EventArgs>((@object, args) => { tTest = true; }));

             tPoco.OnEvent(null, null);

             Assert.AreEqual(true, tTest);

             var tPoco2 = new PropPoco() { Prop2 = 3 };

             Impromptu.InvokeAddAssignMember(tPoco2, "Prop2", 4);

             Assert.AreEqual(7L, tPoco2.Prop2);
         }