public void WhenTheTypesAreUnrelatedButTheSourceTypeImlementsIConvertibleReturnsAFuncThatReturnsTheResultOfACallToConvertChangeType()
        {
            var f = ConvertFuncFactory.GetConvertFunc(typeof(Qux), typeof(Foo));

            var qux = new Qux();

            Assert.That(f(qux), Is.InstanceOf <Foo>());
        }
        public void WhenTheTypesAreUnrelatedButTheSourceTypeImplementsIConvertibleReturnsAFuncThatReturnsTheResultOfACallToConvertChangeButWhenThatCallThrowsAnExceptionReturnTheInputObject()
        {
            var f = ConvertFuncFactory.GetConvertFunc(typeof(Qux), typeof(Bar));

            var qux = new Qux();

            Assert.That(f(qux), Is.InstanceOf <Qux>());
        }
        public void WhenTheTypesAreUnrelatedButATypeConverterIsDefinedForTheDestinationTypeAndCanConvertFromTheSourceTypeReturnsAFuncThatReturnsTheResultOfTheTypeConvertersConvertFromMethod()
        {
            var f = ConvertFuncFactory.GetConvertFunc(typeof(Foo), typeof(Baz));

            var foo = new Foo();

            Assert.That(f(foo), Is.InstanceOf <Baz>());
        }
        public void WhenTheTypesAreUnrelatedButAConversionOperatorIsDefinedBetweenThemReturnsAFuncThatExecutesTheConversionOperator()
        {
            var f = ConvertFuncFactory.GetConvertFunc(typeof(Foo), typeof(Bar));

            var foo = new Foo();

            Assert.That(f(foo), Is.InstanceOf <Bar>());
        }
        public void WhenDestinationTypeInheritsFromSourceTypeReturnsAFuncThatReturnsTheInputObject()
        {
            var f = ConvertFuncFactory.GetConvertFunc(typeof(Foo), typeof(IFoo));

            var foo = new Foo();

            Assert.That(f(foo), Is.InstanceOf <Foo>());
        }
        public void WhenTheTypesAreUnrelatedReturnsAFuncThatReturnsTheInputObject()
        {
            var f = ConvertFuncFactory.GetConvertFunc(typeof(Foo), typeof(double));

            var foo = new Foo();

            Assert.That(f(foo), Is.InstanceOf <Foo>());
        }
        public void WhenBothTypesAreTheSameReturnsAFuncThatReturnsTheInputObject()
        {
            var f = ConvertFuncFactory.GetConvertFunc(typeof(int), typeof(int));

            Assert.That(f(1), Is.InstanceOf <int>());
        }