コード例 #1
0
        public void InvalidTypeResultsInUnsetValue()
        {
            // Arrange
            var conv = new InvertBool();

            // Act
            var result = conv.Convert(string.Empty, null, null, null);

            // Assert
            Assert.AreEqual(DependencyProperty.UnsetValue, result);
        }
コード例 #2
0
        public void BoolIsInverted()
        {
            // Arrange
            var conv = new InvertBool();

            // Act
            bool convertedTrue      = (bool)conv.Convert(true, null, null, null);
            bool convertedFalse     = (bool)conv.Convert(false, null, null, null);
            bool backConvertedTrue  = (bool)conv.ConvertBack(true, null, null, null);
            bool backConvertedFalse = (bool)conv.ConvertBack(false, null, null, null);

            // Assert
            Assert.IsFalse(convertedTrue);
            Assert.IsTrue(convertedFalse);
            Assert.IsFalse(backConvertedTrue);
            Assert.IsTrue(backConvertedFalse);
        }