public void CallMethod_TwoTypeArgs_WithDifferentReturnType_ShouldNotAffectResult()
        {
            var someInstance = new SomeClass();
            var expected     = 1;

            var objectResult = someInstance.CallMethod <int, object>("AddOne", 0);
            var actualResult = someInstance.CallMethod <int, int>("AddOne", 0);

            Assert.Equal(expected, (int)objectResult.GetValueOrDefault());
            Assert.Equal(expected, actualResult.GetValueOrDefault());
        }
        public void CallMethod_OneTypeArg_WithDifferentReturnType_ShouldNotAffectResult()
        {
            var someInstance = new SomeClass();
            var expected     = 42;

            var objectResult = someInstance.CallMethod <object>("GetTheAnswerToTheUniverse");
            var actualResult = someInstance.CallMethod <int>("GetTheAnswerToTheUniverse");

            Assert.Equal(expected, (int)objectResult.GetValueOrDefault());
            Assert.Equal(expected, actualResult.GetValueOrDefault());
        }
        public void CallMethod_OneTypeArg_WithDifferentReferenceTypeReturnType_ShouldNotAffectResult()
        {
            var someInstance = new SomeClass();
            var expected     = someInstance;

            var objectResult = someInstance.CallMethod <object>("ReturnThis");
            var actualResult = someInstance.CallMethod <SomeClass>("ReturnThis");

            // Throws
            Assert.ThrowsAny <Exception>(() => someInstance.CallMethod <int>("ReturnThis"));

            Assert.Equal(expected, objectResult.GetValueOrDefault());
            Assert.Equal(expected, actualResult.GetValueOrDefault());
        }
        public void CallMethod_TwoTypeArgs_WithDifferentReferenceTypeReturnType_ShouldNotAffectResult()
        {
            var someInstance  = new SomeClass();
            var paramInstance = new SomeClass();
            var expected      = paramInstance;

            var objectResult    = someInstance.CallMethod <SomeClass, object>("ReturnParam", paramInstance);
            var actualResult    = someInstance.CallMethod <SomeClass, SomeClass>("ReturnParam", paramInstance);
            var baseClassResult = someInstance.CallMethod <SomeClass, SomeBaseClass>("ReturnParam", paramInstance);

            // Throws
            Assert.ThrowsAny <Exception>(() => someInstance.CallMethod <SomeClass, int>("ReturnParam", paramInstance));

            Assert.Equal(expected, objectResult.GetValueOrDefault());
            Assert.Equal(expected, actualResult.GetValueOrDefault());
            Assert.Equal(expected, baseClassResult.GetValueOrDefault());
        }