public void InvertsBoolean()
        {
            var converter = new InvertBooleanConverter();

            Assert.True(converter.Convert(false, null, null));
            Assert.False(converter.Convert(true, null, null));
        }
示例#2
0
        public void InvertBoolean_ConvertBack()
        {
            // Arrange
            InvertBooleanConverter converter = new InvertBooleanConverter();

            // Act and assert.
            converter.ConvertBack(true, typeof(Boolean), null, CultureInfo.CurrentCulture);
        }
        public void Test_ConvertBack()
        {
            var target = new InvertBooleanConverter();

            target.ConvertBack(true, null, null, null).Should().Be(false);
            target.ConvertBack(false, null, null, null).Should().Be(true);
            target.ConvertBack(1, null, null, null).Should().Be(DependencyProperty.UnsetValue);
            target.ConvertBack("0", null, null, null).Should().Be(DependencyProperty.UnsetValue);
        }
        public void WhenConstructedThenInitialized()
        {
            // Arrange

            // Act
            var actual = new InvertBooleanConverter();

            // Assert
            Assert.IsNotNull(actual);
        }
示例#5
0
        public void InvertBooleanConverterTest()
        {
            var converter = new InvertBooleanConverter();
            var result    = converter.Convert(true, null, null, null);

            Assert.AreEqual(result, false);
            var convertBackResult = converter.ConvertBack(result, null, null, null);

            Assert.AreEqual(convertBackResult, true);
        }
示例#6
0
        public void InvertBoolean_WrongType_ReturnInput()
        {
            // Arrange
            InvertBooleanConverter converter = new InvertBooleanConverter();
            object wrongType = new object();

            // Act
            object result = converter.Convert(wrongType, typeof(Boolean), null, CultureInfo.CurrentCulture);

            // Assert
            Assert.AreSame(wrongType, result);
        }
示例#7
0
        public void InvertBoolean_Convert()
        {
            // Arrange
            InvertBooleanConverter converter = new InvertBooleanConverter();

            // Act
            bool resultT = (bool)converter.Convert(true, typeof(Boolean), null, CultureInfo.CurrentCulture);
            bool resultF = (bool)converter.Convert(false, typeof(Boolean), null, CultureInfo.CurrentCulture);

            // Assert
            Assert.IsFalse(resultT);
            Assert.IsTrue(resultF);
        }
        public void WhenConvertBackCalledWithFalseThenTrueReturned()
        {
            // Arrange
            var expected = true;

            var value = false;

            var target = new InvertBooleanConverter();

            // Act
            var actual = target.ConvertBack(value, typeof(bool), null, CultureInfo.InvariantCulture);

            // Assert
            Assert.AreEqual(expected, actual);
        }
        public void WhenConvertCalledWithNullThenUnsetValueReturned()
        {
            // Arrange
            var expected = DependencyProperty.UnsetValue;

            var value = new object();

            var target = new InvertBooleanConverter();

            // Act
            var actual = target.Convert(value, typeof(bool), null, CultureInfo.InvariantCulture);

            // Assert
            Assert.AreEqual(expected, actual);
        }
示例#10
0
        public void InvertBooleanConverter_TwoWayConvert_Success()
        {
            var converter = new InvertBooleanConverter();

            PerformTwoWayConverterTest(converter, false, true, null);
        }
        public override void SetUp()
        {
            base.SetUp();

            this.converter = new InvertBooleanConverter();
        }
 public void SetUp()
 {
     _invertBooleanConverter = new InvertBooleanConverter();
 }