public void CanConvert_always_returns_true_if_types_are_same()
        {
            var converter = new RuleBasedConverter(new DefaultExtensionPoints(), EmptyArray <IConversionRule> .Instance);

            Assert.IsTrue(converter.CanConvert(typeof(int), typeof(int)));
            Assert.IsFalse(converter.CanConvert(typeof(int), typeof(string)));
        }
        public void CanConvert_returns_true_if_and_only_if_a_conversion_rule_supports_the_conversion()
        {
            var mockRule0 = MockRepository.GenerateStub <IConversionRule>();
            var mockRule1 = MockRepository.GenerateStub <IConversionRule>();
            var converter = new RuleBasedConverter(new DefaultExtensionPoints(), new[] { mockRule0, mockRule1 });;

            mockRule0.Stub(x => x.GetConversionCost(typeof(int), typeof(string), converter)).Return(ConversionCost.Invalid);
            mockRule1.Stub(x => x.GetConversionCost(typeof(int), typeof(string), converter)).Return(ConversionCost.Invalid);
            mockRule0.Stub(x => x.GetConversionCost(typeof(double), typeof(string), converter)).Return(ConversionCost.Default);
            mockRule1.Stub(x => x.GetConversionCost(typeof(double), typeof(string), converter)).Return(ConversionCost.Invalid);
            Assert.IsFalse(converter.CanConvert(typeof(int), typeof(string)));
            Assert.IsTrue(converter.CanConvert(typeof(double), typeof(string)));
        }