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));
        }
Пример #2
0
        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));
        }
Пример #4
0
        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"));
        }