示例#1
0
        public void Wraps_Result_In_IgnoreNull()
        {
            var ignore = new IgnoreNull(new Duck());

            Assert.IsInstanceOfType(typeof(IgnoreNull), ignore.QuackGet("Name", null));
            Assert.IsInstanceOfType(typeof(IgnoreNull), ignore.QuackSet("Name", null, "Donald"));
            Assert.IsInstanceOfType(typeof(IgnoreNull), ignore.QuackInvoke("ToString", null));

            Assert.AreEqual(true, ignore.QuackGet("_IsIgnoreNullReferencingNotNullObject_", null));
        }
示例#2
0
        public void Can_Get_With_Parameters()
        {
            var duck = new Duck {Name = "Donald"};
            var ignore = new IgnoreNull(duck);

            Assert.AreEqual(duck.Name, ignore.QuackGet("Item", new object[1] {1}).ToString());
        }
示例#3
0
        public void Returns_Itself_For_Null_Targets()
        {
            var ignore = new IgnoreNull(null);

            Assert.AreEqual(ignore, ignore.QuackGet(null, null));
            Assert.AreEqual(ignore, ignore.QuackSet(null, null, null));
            Assert.AreEqual(ignore, ignore.QuackInvoke(null, null));
        }