public void IndexToArrayConverter(int value, bool expectedResult)
        {
            var intToBoolConverter = new IntToBoolConverter();

            var result = intToBoolConverter.Convert(value, typeof(IntToBoolConverter_Tests), null, CultureInfo.CurrentCulture);

            Assert.AreEqual(result, expectedResult);
        }
Пример #2
0
        public void Cannot_Get_Bool_From_Null_Value()
        {
            //Arrange
            IntToBoolConverter converter = new IntToBoolConverter();

            //Act
            ActualValueDelegate <object> testDelegate = () => converter.Convert(null, typeof(bool), null, CultureInfo.CurrentCulture);

            //Assert
            Assert.That(testDelegate, Throws.TypeOf <NullReferenceException>());
        }
Пример #3
0
        public void Cannot_Get_Bool_From_Invalid_Type_Value()
        {
            //Arrange
            var convertFrom = "string";

            IntToBoolConverter converter = new IntToBoolConverter();

            //Act
            ActualValueDelegate <object> testDelegate = () => converter.Convert(convertFrom, typeof(bool), null, CultureInfo.CurrentCulture);

            //Assert
            Assert.That(testDelegate, Throws.TypeOf <InvalidCastException>());
        }
Пример #4
0
        public void Can_Get_False_If_Value_Zero()
        {
            //Arrange
            var convertFrom = 0;

            IntToBoolConverter converter = new IntToBoolConverter();

            //Act
            var result = converter.Convert(convertFrom, typeof(bool), null, CultureInfo.CurrentCulture);

            //Assert
            Assert.AreEqual(result, false);
        }
        public void InValidConverterValuesThrowArgumenException(object value)
        {
            var intToBoolConverter = new IntToBoolConverter();

            Assert.Throws <ArgumentException>(() => intToBoolConverter.Convert(value, typeof(IndexToArrayItemConverter), null, CultureInfo.CurrentCulture));
        }