Example #1
0
 public void Should_return_true_for_nullable_structs()
 {
     IntBasedStructEnumTypeConverter.CanConvertFrom(typeof(StructIntegerEnum?)).Should().BeTrue();
 }
Example #2
0
 public void Should_return_true_for_structs()
 {
     IntBasedStructEnumTypeConverter.CanConvertTo(typeof(StructIntegerEnum)).Should().BeTrue();
 }
 public void Should_convert_null_to_nullable_struct()
 {
     IntBasedStructEnumTypeConverter.ConvertTo(null, null, null, typeof(StructIntegerEnum?)).Should().BeNull();
 }
 public void Should_convert_struct_enum_to_nullable_struct()
 {
     IntBasedStructEnumTypeConverter.ConvertTo(null, null, StructIntegerEnum.Item1, typeof(StructIntegerEnum?)).Should().Be(StructIntegerEnum.Item1);
 }
 public void Should_throw_trying_to_convert_null_to_structs()
 {
     IntBasedStructEnumTypeConverter.Invoking(c => c.ConvertFrom(null, null, null))
     .Should().Throw <NotSupportedException>().WithMessage("StructIntegerEnum is a struct and cannot be converted from 'null'.");
 }
 public void Should_convert_to_struct_enum()
 {
     IntBasedStructEnumTypeConverter.ConvertFrom(null, null, 1).Should().Be(StructIntegerEnum.Item1);
 }