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; 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); }
public void TestIsEvent() { dynamic tPoco = new PocoEvent(); var tResult = Dynamic.InvokeIsEvent(tPoco, "Event"); Assert.AreEqual(true, tResult); }
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); }
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); }
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); }
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); }
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); }
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); }
public void TestIsEvent() { dynamic tPoco = new PocoEvent(); var tResult = Impromptu.InvokeIsEvent(tPoco, "Event"); Assert.AreEqual(true, tResult); }
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); }
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); }