public void ConvertToString() { Type destinationType = typeof(string); Assert.That(_int32EnumConverter.ConvertTo(Int32Enum.ValueA, destinationType), Is.EqualTo("ValueA")); Assert.That(_int32EnumConverter.ConvertTo(Int32Enum.ValueB, destinationType), Is.EqualTo("ValueB")); Assert.That(_nullableInt32EnumConverter.ConvertTo(Int32Enum.ValueA, destinationType), Is.EqualTo("ValueA")); Assert.That(_nullableInt32EnumConverter.ConvertTo(null, destinationType), Is.EqualTo(string.Empty)); }
public void ConvertToInt32_WithInt16EnumConverter() { Assert.That(_int16EnumConverter.ConvertTo(Int32Enum.ValueB, typeof(Int32)), Is.EqualTo(1)); }
public void ConvertToString() { Type destinationType = typeof(string); Assert.That(_int32EnumConverter.ConvertTo(Int32Enum.Value0, destinationType), Is.EqualTo("Value0")); Assert.That(_int32EnumConverter.ConvertTo(Int32Enum.Value1, destinationType), Is.EqualTo("Value1")); Assert.That(_int32EnumConverter.ConvertTo(Int32Enum.Value2, destinationType), Is.EqualTo("Value2")); Assert.That(_int32EnumConverter.ConvertTo(Int32Enum.Value5, destinationType), Is.EqualTo("Value5")); Assert.That(_int32EnumConverter.ConvertTo(Int32Enum.Value1 | Int32Enum.Value2, destinationType), Is.EqualTo("Value1, Value2")); Assert.That(_nullableInt32EnumConverter.ConvertTo(Int32Enum.Value1, destinationType), Is.EqualTo("Value1")); Assert.That(_nullableInt32EnumConverter.ConvertTo(Int32Enum.Value5, destinationType), Is.EqualTo("Value5")); Assert.That(_nullableInt32EnumConverter.ConvertTo(Int32Enum.Value1 | Int32Enum.Value2, destinationType), Is.EqualTo("Value1, Value2")); Assert.That(_nullableInt32EnumConverter.ConvertTo(null, destinationType), Is.EqualTo(string.Empty)); }