コード例 #1
0
ファイル: Invoke.cs プロジェクト: ijsgaus/dynamitey
        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);
        }
コード例 #2
0
ファイル: Invoke.cs プロジェクト: ijsgaus/dynamitey
        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);
        }
コード例 #3
0
ファイル: Invoke.cs プロジェクト: ijsgaus/dynamitey
        public void TestIsEvent()
        {
            dynamic tPoco = new PocoEvent();

            var tResult = Dynamic.InvokeIsEvent(tPoco, "Event");

            Assert.AreEqual(true, tResult);
        }
コード例 #4
0
        public void EventPocoPropertyTest()
        {
            var tPoco     = new PocoEvent();
            var tActsLike = tPoco.ActLike <IEvent>();
            var tSet      = false;

            tActsLike.Event += (obj, args) => tSet = true;

            tActsLike.OnEvent(null, null);
            Assert.AreEqual(true, tSet);
        }
コード例 #5
0
        public void EventPocoPropertyTest2()
        {
            var tPoco     = new PocoEvent();
            var tActsLike = tPoco.ActLike <IEvent>();
            var tSet      = false;
            EventHandler <EventArgs> tActsLikeOnEvent = (obj, args) => tSet = true;

            tActsLike.Event += tActsLikeOnEvent;
            tActsLike.Event -= tActsLikeOnEvent;
            tActsLike.OnEvent(null, null);
            Assert.AreEqual(false, tSet);
        }
コード例 #6
0
ファイル: Invoke.cs プロジェクト: ijsgaus/dynamitey
        public void TestCacheableIsEventAndIsNotEvent()
        {
            object tPoco = new PocoEvent();

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

            var tResult = tCachedInvoke.Invoke(tPoco);

            Assert.AreEqual(true, tResult);

            dynamic tDynamic = new DynamicObjects.Dictionary();

            tDynamic.Event = null;

            var tResult2 = tCachedInvoke.Invoke((object)tDynamic);

            Assert.AreEqual(false, tResult2);
        }
コード例 #7
0
ファイル: Invoke.cs プロジェクト: ijsgaus/dynamitey
        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);
        }
コード例 #8
0
ファイル: Invoke.cs プロジェクト: ijsgaus/dynamitey
        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);
        }
コード例 #9
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);
         }
コード例 #10
0
         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);
         }
コード例 #11
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);
         }
コード例 #12
0
         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);
         }
コード例 #13
0
        public void TestCacheableIsEventAndIsNotEvent()
        {
            object tPoco = new PocoEvent();

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

            var tResult = tCachedInvoke.Invoke(tPoco);

            Assert.AreEqual(true, tResult);

            dynamic tDynamic = new ImpromptuDictionary();

            tDynamic.Event = null;

            var tResult2 = tCachedInvoke.Invoke((object) tDynamic);

            Assert.AreEqual(false, tResult2);
        }
コード例 #14
0
        public void TestIsEvent()
        {
            dynamic tPoco = new PocoEvent();

            var tResult = Impromptu.InvokeIsEvent(tPoco, "Event");

            Assert.AreEqual(true, tResult);
        }
コード例 #15
0
        public void EventPocoPropertyTest2()
        {
            var tPoco = new PocoEvent();
            var tActsLike = tPoco.ActLike<IEvent>();
            var tSet = false;
            EventHandler<EventArgs> tActsLikeOnEvent = (obj, args) => tSet = true;
            tActsLike.Event += tActsLikeOnEvent;
            tActsLike.Event -= tActsLikeOnEvent;
            tActsLike.OnEvent(null, null);
            Assert.AreEqual(false, tSet);

        }
コード例 #16
0
        public void EventPocoPropertyTest()
        {
            var tPoco = new PocoEvent();
            var tActsLike = tPoco.ActLike<IEvent>();
            var tSet = false;
            tActsLike.Event += (obj, args) => tSet = true;

            tActsLike.OnEvent(null, null);
            Assert.AreEqual(true, tSet);

        }