public void ConvertBack_NotSupportedException()
        {
            // Arrange
            IValueConverter converter = new BoolInvertConverter();

            // Act & Assert
            Assert.Throws <NotSupportedException>(() => converter.ConvertBack(true, typeof(bool), null, CultureInfo.InvariantCulture));
        }
        public void Convert_ArgumentException_InvalidTargetType()
        {
            // Arrange
            IValueConverter converter = new BoolInvertConverter();

            // Act & Assert
            Assert.Throws <ArgumentException>(() => converter.Convert(true, typeof(long), null, CultureInfo.InvariantCulture));
        }
        public void Convert_ArgumentNullException_Value()
        {
            // Arrange
            IValueConverter converter = new BoolInvertConverter();

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => converter.Convert(null, typeof(bool), null, CultureInfo.InvariantCulture));
        }
        public void Convert_CorrectConversion(bool input, bool expected)
        {
            // Arrange
            IValueConverter converter = new BoolInvertConverter();

            // Act
            var converted = converter.Convert(input, typeof(bool), null, CultureInfo.InvariantCulture);

            // Assert
            Assert.AreEqual(expected, converted);
        }
Example #5
0
        public void ConvertBackTest_NotBool()
        {
            var result = new BoolInvertConverter().ConvertBack("", null, null, null);

            Assert.AreEqual(false, result);
        }
Example #6
0
        public void ConvertBackTest_false()
        {
            var result = new BoolInvertConverter().ConvertBack(false, null, null, null);

            Assert.AreEqual(true, result);
        }