public void InvertsBoolean() { var converter = new InvertBooleanConverter(); Assert.True(converter.Convert(false, null, null)); Assert.False(converter.Convert(true, null, null)); }
public void Test_Convert() { var target = new InvertBooleanConverter(); target.Convert(true, null, null, null).Should().Be(false); target.Convert(false, null, null, null).Should().Be(true); target.Convert(1, null, null, null).Should().Be(DependencyProperty.UnsetValue); target.Convert("0", null, null, null).Should().Be(DependencyProperty.UnsetValue); }
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 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); }
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); }
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); }
public void WhenConvertCalledWithFalseThenTrueReturned() { // Arrange var expected = true; var value = false; var target = new InvertBooleanConverter(); // Act var actual = target.Convert(value, typeof(bool), null, CultureInfo.InvariantCulture); // Assert Assert.AreEqual(expected, actual); }