Example #1
0
        public void DictionaryMethodsTestWithPropertyAccess()
        {
            dynamic tNew = new DynamicObjects.Dictionary();
            tNew.PropCat = "Cat-";
            tNew.Action1 = new Action(Assert.Fail);
            tNew.Action2 = new Action<bool>(Assert.IsFalse);
            tNew.Action3 = new ThisFunc<string>(@this => @this.PropCat + "test");

            Assert.That(() => tNew.Action1(), Throws.InstanceOf<AssertionException>());
            Assert.That(() => tNew.Action2(true), Throws.InstanceOf<AssertionException>());

            Assert.AreEqual("Cat-test", tNew.Action3());
        }
Example #2
0
        public void DictionaryMethodsTest()
        {
            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);

            Assert.That(() => tNew.Action1(), Throws.InstanceOf<AssertionException>());
            Assert.That(() => tNew.Action2(true), Throws.InstanceOf<AssertionException>());

            Assert.That(tNew.Action3(), Is.EqualTo("test"));

            Assert.That(tNew.Action4(4), Is.EqualTo("test4"));
        }
Example #3
0
        public void DictionaryMethodsTestWithPropertyAccess()
        {
            dynamic tNew = new DynamicObjects.Dictionary();

            tNew.PropCat = "Cat-";
            tNew.Action1 = new Action(Assert.Fail);
            tNew.Action2 = new Action <bool>(Assert.IsFalse);
            tNew.Action3 = new ThisFunc <string>(@this => @this.PropCat + "test");



            Assert.That(() => tNew.Action1(), Throws.InstanceOf <AssertionException>());
            Assert.That(() => tNew.Action2(true), Throws.InstanceOf <AssertionException>());

            Assert.AreEqual("Cat-test", tNew.Action3());
        }
Example #4
0
        public void DictionaryMethodsTest()
        {
            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);



            Assert.That(() => tNew.Action1(), Throws.InstanceOf <AssertionException>());
            Assert.That(() => tNew.Action2(true), Throws.InstanceOf <AssertionException>());

            Assert.That((object)tNew.Action3(), Is.EqualTo("test"));

            Assert.That((object)tNew.Action4(4), Is.EqualTo("test4"));
        }