public void CanConvert() { // arrange var converter = new EnumConverter(); // act var result1 = converter.CanConvert(System.ConsoleColor.Black.GetType()); var result2 = converter.CanConvert(typeof(System.ConsoleColor?)); var result3 = converter.CanConvert("".GetType()); // assert Assert.IsTrue(result1); Assert.IsTrue(result2); Assert.IsFalse(result3); }
private void should_return_false_given_non_enum_type_when_checking_can_convert(EnumConverter converter) { // given // when var result = converter.CanConvert(typeof(EnumConverter)); // then result.ShouldBeFalse(); }
private void should_return_true_given_enum_type_when_checking_can_convert(EnumConverter converter) { // given // when var result = converter.CanConvert(typeof(TestControl)); // then result.ShouldBeTrue(); }
public void ShouldReturnTrueWhenTypeIsNullableEnum() { EnumConverter <TestEnum> converter = new EnumConverter <TestEnum>(); Assert.IsFalse(converter.CanConvert(typeof(TestEnum?))); }
public void ShouldReturnTrueWhenTypeIsEnum() { EnumConverter <TestEnum> converter = new EnumConverter <TestEnum>(); Assert.IsTrue(converter.CanConvert(typeof(TestEnum))); }
public void CanConvertTests(Type type, bool expected) { var converter = new EnumConverter(); Assert.Equal(expected, converter.CanConvert(type)); }
public void CanConvert_NullableTestEnum_ReturnsTrue() { EnumConverter <TestEnum> converter = new EnumConverter <TestEnum>(); Assert.IsFalse(converter.CanConvert(typeof(TestEnum?))); }
public void CanConvert_TestEnum_ReturnsTrue() { EnumConverter <TestEnum> converter = new EnumConverter <TestEnum>(); Assert.IsTrue(converter.CanConvert(typeof(TestEnum))); }