Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
0
        public void Wraps_Result_In_IgnoreNull()
        {
            var ignore = new IgnoreNull(new Duck());

            Assert.IsInstanceOf <IgnoreNull>(ignore.QuackGet("Name", null));
            Assert.IsInstanceOf <IgnoreNull>(ignore.QuackSet("Name", null, "Donald"));
            Assert.IsInstanceOf <IgnoreNull>(ignore.QuackInvoke("ToString", null));

            Assert.AreEqual(true, ignore.QuackGet("_IsIgnoreNullReferencingNotNullObject_", null));
        }
Ejemplo n.º 3
0
        public void Can_Set_With_Parameters()
        {
            var duck   = new Duck();
            var ignore = new IgnoreNull(duck);

            ignore.QuackSet("Item", new object[1] {
                1
            }, "Donald");

            Assert.AreEqual("Donald", duck.Name);
        }