public void ForwardVoidTest() { var tPoco = new VoidMethodPoco(); dynamic tTest = new TestForwarder(tPoco); tTest.Action(); }
public void ForwardGenericMethodsTest() { dynamic tNew = new ForwardGenericMethodsTestClass(); dynamic tFwd = new TestForwarder(tNew); Assert.AreEqual("test99", tFwd.Create <ForwardGenericMethodsTestClass>(99).Value); }
public void ForwardAnonTest() { var tAnon = new { Prop1 = "Test", Prop2 = 42L, Prop3 = Guid.NewGuid() }; dynamic tTest = new TestForwarder(tAnon); Assert.AreEqual(tAnon.Prop1, tTest.Prop1); Assert.AreEqual(tAnon.Prop2, tTest.Prop2); Assert.AreEqual(tAnon.Prop3, tTest.Prop3); }
public void ForwardDynamicTest() { dynamic tNew = new ExpandoObject(); tNew.Prop1 = "Test"; tNew.Prop2 = 42L; tNew.Prop3 = Guid.NewGuid(); dynamic tTest = new TestForwarder(tNew); Assert.AreEqual(tNew.Prop1, tTest.Prop1); Assert.AreEqual(tNew.Prop2, tTest.Prop2); Assert.AreEqual(tNew.Prop3, tTest.Prop3); }
public void ForwardMethodsTest() { dynamic tNew = new Dictionary(); tNew.Action1 = new Action(Assert.Fail); tNew.Action2 = new Action <bool>(Assert.IsFalse); tNew.Action3 = new Func <string>(() => "test"); tNew.Action4 = new Func <int, string>(arg => "test" + arg); dynamic tFwd = new TestForwarder(tNew); AssertException <AssertionException>(() => tFwd.Action1()); AssertException <AssertionException>(() => tFwd.Action2(true)); Assert.AreEqual("test", tFwd.Action3()); Assert.AreEqual("test4", tFwd.Action4(4)); }
public void ForwardMethodsTest() { dynamic tNew = new DynamicObjects.Dictionary(); tNew.Action1 = new Action(Assert.Fail); tNew.Action2 = new Action <bool>(Assert.IsFalse); tNew.Action3 = new Func <string>(() => "test"); tNew.Action4 = new Func <int, string>(arg => "test" + arg); dynamic tFwd = new TestForwarder(tNew); Assert.That(() => tFwd.Action1(), Throws.InstanceOf <AssertionException>()); Assert.That(() => tFwd.Action2(true), Throws.InstanceOf <AssertionException>()); Assert.That((object)tFwd.Action3(), Is.EqualTo("test")); Assert.That((object)tFwd.Action4(4), Is.EqualTo("test4")); }
public void ForwardMethodsTest() { dynamic tNew = new ImpromptuDictionary(); tNew.Action1 = new Action(Assert.Fail); tNew.Action2 = new Action<bool>(Assert.IsFalse); tNew.Action3 = new Func<string>(() => "test"); tNew.Action4 = new Func<int, string>(arg => "test" + arg); dynamic tFwd = new TestForwarder(tNew); AssertException<AssertionException>(()=> tFwd.Action1()); AssertException<AssertionException>(() => tFwd.Action2(true)); Assert.AreEqual("test", tFwd.Action3()); Assert.AreEqual("test4", tFwd.Action4(4)); }
public void ForwardMethodsTest() { dynamic tNew = new DynamicObjects.Dictionary(); tNew.Action1 = new Action(Assert.Fail); tNew.Action2 = new Action<bool>(Assert.IsFalse); tNew.Action3 = new Func<string>(() => "test"); tNew.Action4 = new Func<int, string>(arg => "test" + arg); dynamic tFwd = new TestForwarder(tNew); Assert.That(() => tFwd.Action1(), Throws.InstanceOf<AssertionException>()); Assert.That(() => tFwd.Action2(true), Throws.InstanceOf<AssertionException>()); Assert.That(tFwd.Action3(), Is.EqualTo("test")); Assert.That(tFwd.Action4(4), Is.EqualTo("test4")); }