public void Should_return_self_if_converted_to_itself() { var valueObject = IntBasedStructValueObject.Create(42); IntBasedStructValueObjectTypeConverter.ConvertTo(valueObject, typeof(IntBasedStructValueObject)).Should().Be(valueObject); }
public void Should_return_valid_instance_if_converted_to_nullable_type_of_itself() { IntBasedStructValueObject?valueObject = IntBasedStructValueObject.Create(42); IntBasedStructValueObjectTypeConverter.ConvertTo(valueObject, typeof(IntBasedStructValueObject?)).Should().Be(valueObject.Value); }
public void Should_return_true_if_value_type_is_struct_and_key_type_matches_the_nullable_struct_key() { IntBasedStructValueObjectTypeConverter.CanConvertTo(typeof(int?)).Should().BeTrue(); }
public void Should_return_key_if_value_type_is_struct_and_key_matches_the_struct_key() { IntBasedStructValueObjectTypeConverter.ConvertTo(IntBasedStructValueObject.Create(42), typeof(int)).Should().Be(42); }
public void Should_return_true_if_destination_type_is_nullable_value_type_of_itself() { IntBasedStructValueObjectTypeConverter.CanConvertTo(typeof(IntBasedStructValueObject?)).Should().BeTrue(); }
public void Should_throw_if_value_type_is_struct_and_key_is_null() { IntBasedStructValueObjectTypeConverter.Invoking(c => c.ConvertFrom(null)) .Should().Throw <NotSupportedException>() .WithMessage("IntBasedStructValueObject is a struct and cannot be converted from 'null'."); }
public void Should_return_self_if_converted_from_itself() { var valueObject = IntBasedStructValueObject.Create(42); IntBasedStructValueObjectTypeConverter.ConvertFrom(valueObject).Should().Be(valueObject); }
public void Should_return_valid_instance_if_value_type_is_struct_and_key_matches_the_struct_key() { IntBasedStructValueObjectTypeConverter.ConvertFrom(42).Should().BeEquivalentTo(IntBasedStructValueObject.Create(42)); }
public void Should_return_true_if_source_type_is_value_type_itself() { IntBasedStructValueObjectTypeConverter.CanConvertFrom(typeof(IntBasedStructValueObject)).Should().BeTrue(); }