public void IfNotNull_WithTarget_CallFuncTTR_ReturnOtherType()
        {
            var target = new MockClass1();

            MockClass2 otherRtn = target.IfNotNull(x => new MockClass2());

            Assert.IsNotNull(otherRtn);
        }
        public void IfNotNull_WithTarget_CallFuncTR_ReturnOtherType()
        {
            var target = new MockClass1();

            // Do not call Func<TR>(), return default(TR)
            MockClass2 otherRtn = target.IfNotNull(() => new MockClass2());

            Assert.IsNotNull(otherRtn);
        }
        public void IfNotNull_WithTarget_CallAction_ReturnSameType()
        {
            var target = new MockClass1();

            var rtn = target.IfNotNull(() => target.MethodReturnVoid());

            Assert.IsNotNull(rtn);
            Assert.AreSame(rtn, target);
            Assert.IsTrue(target.SomeMethodCalled);
        }