Exemple #1
0
        public void TestConvertBack1()
        {
            var converter = new InvertBoolConverter();

            converter.ConvertBack(true, typeof(bool), null, null).Should().Be(false);
            converter.ConvertBack(false, typeof(bool), null, null).Should().Be(true);
        }
Exemple #2
0
        public void TestConvertBack2()
        {
            var converter = new InvertBoolConverter();

            converter.ConvertBack(42, typeof(bool), null, null).Should().BeNull();
            converter.ConvertBack("false", typeof(bool), null, null).Should().BeNull();
            converter.ConvertBack("true", typeof(bool), null, null).Should().BeNull();
            converter.ConvertBack("clondyke bar", typeof(bool), null, null).Should().BeNull();
        }
Exemple #3
0
        public void InvertBoolConverterTest()
        {
            // ReSharper disable PossibleNullReferenceException
            var conv = new InvertBoolConverter();

            var trueForward  = (bool)conv.Convert(true, null, null, _cult);
            var falseForward = (bool)conv.Convert(false, null, null, _cult);

            Assert.IsFalse(trueForward);
            Assert.IsTrue(falseForward);

            var trueBack  = (bool)conv.ConvertBack(false, null, null, _cult);
            var falseBack = (bool)conv.ConvertBack(true, null, null, _cult);

            Assert.IsTrue(trueBack);
            Assert.IsFalse(falseBack);
            // ReSharper restore PossibleNullReferenceException
        }