public void TestConvert2([Values(double.NaN, double.PositiveInfinity, double.NegativeInfinity)] double invalidValue) { var converter = new AdjustingDoubleConverter(); converter.Convert(invalidValue, typeof(double), null, CultureInfo.CurrentCulture) .Should().Be(0.0); }
public void TestConvert1([Values(1.0, 2.0, 0.5, -42.0)] double value) { var converter = new AdjustingDoubleConverter(); converter.Convert(value, typeof(double), null, CultureInfo.CurrentCulture) .Should().Be(value); }
public void TestConvert3() { var converter = new AdjustingDoubleConverter(); new Action(() => converter.Convert(null, typeof(double), null, CultureInfo.CurrentCulture)).Should().NotThrow(); new Action(() => converter.Convert(42, typeof(double), null, CultureInfo.CurrentCulture)).Should().NotThrow(); new Action(() => converter.Convert(42f, typeof(double), null, CultureInfo.CurrentCulture)).Should().NotThrow(); new Action(() => converter.Convert("42", typeof(double), null, CultureInfo.CurrentCulture)).Should().NotThrow(); new Action(() => converter.Convert(typeof(bool), typeof(double), null, CultureInfo.CurrentCulture)).Should().NotThrow(); }