Esempio n. 1
0
        public void DoubleToIntInValidValuesThrowArgumenException(object value)
        {
            var doubleToIntConverter = new DoubleToIntConverter();

            Assert.Throws <ArgumentException>(() => doubleToIntConverter.Convert(value, typeof(BoolToObjectConverter_Tests), null, CultureInfo.CurrentCulture));
            Assert.Throws <ArgumentException>(() => doubleToIntConverter.ConvertBack(value, typeof(BoolToObjectConverter_Tests), null, CultureInfo.CurrentCulture));
        }
Esempio n. 2
0
        public void DoubleToIntConverter(double value, int expectedResult, object?ratio = null)
        {
            var doubleToIntConverter = new DoubleToIntConverter();

            var result = doubleToIntConverter.Convert(value, typeof(DoubleToIntConverter_Tests), ratio, CultureInfo.CurrentCulture);

            Assert.AreEqual(result, expectedResult);
        }
Esempio n. 3
0
        public void TestThatConvertConvertsDoubleToInt()
        {
            DoubleToIntConverter converter = new DoubleToIntConverter();

            object value = converter.Convert(5.123, typeof(int), null, CultureInfo.CurrentCulture);

            Assert.IsType <int>(value);
            Assert.Equal(5, (int)value);
        }