public void Convert_TargetTypeIsNull_ShouldThrow() { // arrange var source = new Celcius(23); const Type nullTargetType = null; // act & assert _target.Invoking(t => t.Convert(source, nullTargetType)) .ShouldThrow<ArgumentNullException>(); }
public void Convert_ConverterIsRegistered_ShouldConvert() { // arrange var source = new Celcius(0); // act var actual = _target.Convert(source, typeof(Kelvin)); // assert actual.Should().NotBeNull("The value should have been converted"); actual.Should().BeOfType<Kelvin>("The value should have been converted to a Kelvin"); }
public void Convert_NoRegisteredConverter_ShouldThrow() { // arrange var source = new Celcius(23); var targetType = typeof(Farenheit); // act & assert _target.Invoking(t => t.Convert(source, targetType)) .ShouldThrow<ConversionNotRegisteredException>() .And.Message.Should() .Contain(source.GetType().Name) .And.Contain(targetType.Name); }