Exemplo n.º 1
0
        public void TestConvert1()
        {
            var converter = new InvertBoolConverter();

            converter.Convert(true, typeof(bool), null, null).Should().Be(false);
            converter.Convert(false, typeof(bool), null, null).Should().Be(true);
        }
Exemplo n.º 2
0
        public void TestConvert2()
        {
            var converter = new InvertBoolConverter();

            converter.Convert(42, typeof(bool), null, null).Should().BeNull();
            converter.Convert("false", typeof(bool), null, null).Should().BeNull();
            converter.Convert("true", typeof(bool), null, null).Should().BeNull();
            converter.Convert("clondyke bar", typeof(bool), null, null).Should().BeNull();
        }
Exemplo n.º 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
        }