public void CompareConverterInValidValuesThrowArgumenException(object value)
        {
            var compareConverter = new CompareConverter()
            {
                ComparingValue = 20d
            };

            Assert.Throws <ArgumentException>(() => compareConverter.Convert(value, typeof(BoolToObjectConverter_Tests), null !, CultureInfo.CurrentCulture));
        }
        public void CompareConverterInValidValuesThrowArgumentOutOfRangeException(object value, CompareConverter.OperatorType comparisonOperator, IComparable comparingValue)
        {
            var compareConverter = new CompareConverter
            {
                ComparisonOperator = comparisonOperator,
                ComparingValue     = comparingValue
            };

            Assert.Throws <ArgumentOutOfRangeException>(() => compareConverter.Convert(value, typeof(BoolToObjectConverter_Tests), null !, CultureInfo.CurrentCulture));
        }
Пример #3
0
        public void CompareConverterInValidValuesThrowArgumentException(object value)
        {
            var compareConverter = new CompareConverter()
            {
                ComparingValue = 20d
            };

#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
            Assert.Throws <ArgumentException>(() => compareConverter.Convert(value, typeof(BoolToObjectConverter_Tests), null, CultureInfo.CurrentCulture));
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
        }
        public void CompareConverterInValidValuesThrowArgumentNullException(object value, IComparable comparingValue, object trueObject, object falseObject)
        {
            var compareConverter = new CompareConverter()
            {
                ComparingValue = comparingValue,
                FalseObject    = falseObject,
                TrueObject     = trueObject
            };

            Assert.Throws <ArgumentNullException>(() => compareConverter.Convert(value, typeof(BoolToObjectConverter_Tests), null !, CultureInfo.CurrentCulture));
        }
Пример #5
0
        public void Convert_Should_Work(IComparable first, CompareExpressions expression, IComparable second, bool expected)
        {
            //act
            var sut = new CompareConverter()
            {
                With       = second,
                Expression = expression
            };
            var output = sut.Convert(first, typeof(bool), null, Thread.CurrentThread.CurrentCulture);

            //assert
            Assert.Equal(expected, output);
        }
        public void CompareConverterConvert(IComparable value, CompareConverter.OperatorType comparisonOperator, IComparable comparingValue, object trueObject, object falseObject, object expectedResult)
        {
            var compareConverter = new CompareConverter
            {
                TrueObject         = trueObject,
                FalseObject        = falseObject,
                ComparisonOperator = comparisonOperator,
                ComparingValue     = comparingValue
            };

            var result = compareConverter.Convert(value, typeof(BoolToObjectConverter_Tests), null !, CultureInfo.CurrentCulture);

            Assert.AreEqual(result, expectedResult);
        }
Пример #7
0
        public void CompareConverterConvert(IComparable value, CompareConverter.OperatorType comparisonOperator, IComparable comparingValue, object trueObject, object falseObject, object expectedResult)
        {
            var compareConverter = new CompareConverter
            {
                TrueObject         = trueObject,
                FalseObject        = falseObject,
                ComparisonOperator = comparisonOperator,
                ComparingValue     = comparingValue
            };

#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
            var result = compareConverter.Convert(value, typeof(BoolToObjectConverter_Tests), null, CultureInfo.CurrentCulture);
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
            Assert.AreEqual(result, expectedResult);
        }