public void GetConverterForField_WithNoCustomConverter_ReturnsBaseConverter() { var expectedType = typeof(Int32Converter); var actual = ConverterFinder .GetConverterForField( typeof(TestPropertyClass) .GetField("SomeValue")); Assert.IsInstanceOfType(actual, expectedType); }
public void GetConverterForField_WithNoDefaultConverterAndCustomConverterAppliedToProperty_ReturnsCustomConverter() { var expectedType = typeof(CustomClassWithDescriptorConverter); var actual = ConverterFinder .GetConverterForField( typeof(TestPropertyClass) .GetField("AnotherValue")); Assert.IsInstanceOfType(actual, expectedType); }
public void GetConverterForField_WithConverterAppliedToProperty_ReturnsCustomConverter() { var expectedType = typeof(CustomIntConverter); var actual = ConverterFinder .GetConverterForField( typeof(TestPropertyClass) .GetField("SomeCustomValue")); Assert.IsInstanceOfType(actual, expectedType); }
public void GetConverterForField_WithObjectInheritingICustomTypeDescriptor_ReturnsCustomConverter() { var obj = new ClassWithDescriptor(10); var expectedType = typeof(ClassWithDescriptorConverter); var actual = ConverterFinder .GetConverterForField( typeof(TestPropertyClass) .GetField("OtherValue"), obj); Assert.IsInstanceOfType(actual, expectedType); }