public void BooleanVisibilityConverter_Convert_False_ReturnVisible() { BooleanVisibilityConverter converter = new BooleanVisibilityConverter(); Visibility result = (Visibility)converter.Convert(false, typeof(bool), new Object(), CultureInfo.CurrentCulture); Assert.AreEqual(Visibility.Visible, result); }
public void BooleanVisibilityConverter_Convert_Null_ReturnCollapsed() { BooleanVisibilityConverter converter = new BooleanVisibilityConverter(); Visibility result = (Visibility)converter.Convert(null, typeof(object), new Object(), CultureInfo.CurrentCulture); Assert.AreEqual(Visibility.Collapsed, result); }
public void WhenConstructedThenInitialized() { // Arrange // Act var actual = new BooleanVisibilityConverter(); // Assert Assert.IsNotNull(actual); Assert.AreEqual(Visibility.Visible, actual.WhenTrue); Assert.AreEqual(Visibility.Hidden, actual.WhenFalse); Assert.AreEqual(Visibility.Hidden, actual.WhenNull); }
public void WhenConstructedThenInitialized() { // Arrange // Act var actual = new BooleanVisibilityConverter(); // Assert Assert.IsNotNull(actual); Assert.AreEqual(Visibility.Visible, actual.WhenTrue); Assert.AreEqual(Visibility.Hidden, actual.WhenFalse); Assert.AreEqual(Visibility.Hidden, actual.WhenNull); }
public void WhenWhenNullSetThenValueUpdated() { // Arrange var expected = Visibility.Collapsed; var target = new BooleanVisibilityConverter(); // Act target.WhenNull = expected; var actual = target.WhenNull; // Assert Assert.AreEqual(expected, actual); }
public void WhenConvertBackCalledWithNonMatchThenUnsetValueReturned() { // Arrange var expected = DependencyProperty.UnsetValue; var value = Visibility.Collapsed; var target = new BooleanVisibilityConverter(); // Act var actual = target.ConvertBack(value, typeof(bool?), null, CultureInfo.InvariantCulture); // Assert Assert.AreEqual(expected, actual); }
public void WhenConvertBackCalledWithNonMatchThenUnsetValueReturned() { // Arrange var expected = DependencyProperty.UnsetValue; var value = Visibility.Collapsed; var target = new BooleanVisibilityConverter(); // Act var actual = target.ConvertBack(value, typeof(bool?), null, CultureInfo.InvariantCulture); // Assert Assert.AreEqual(expected, actual); }
public void WhenConvertBackCalledWithWhenNullThenNullReturned() { // Arrange var expected = (object)null; var value = Visibility.Collapsed; var target = new BooleanVisibilityConverter(); target.WhenNull = value; // Act var actual = target.ConvertBack(value, typeof(Visibility), null, CultureInfo.InvariantCulture); // Assert Assert.AreEqual(expected, actual); }
public void WhenConvertCalledWithFalseThenWhenFalseReturned() { // Arrange var expected = Visibility.Collapsed; var value = false; var target = new BooleanVisibilityConverter(); target.WhenFalse = expected; // Act var actual = target.Convert(value, typeof(object), null, CultureInfo.InvariantCulture); // Assert Assert.AreEqual(expected, actual); }
public void WhenConvertBackCalledWithWhenNullThenNullReturned() { // Arrange var expected = (object)null; var value = Visibility.Collapsed; var target = new BooleanVisibilityConverter(); target.WhenNull = value; // Act var actual = target.ConvertBack(value, typeof(Visibility), null, CultureInfo.InvariantCulture); // Assert Assert.AreEqual(expected, actual); }
public void WhenWhenTrueSetThenValueUpdated() { // Arrange var expected = Visibility.Collapsed; var target = new BooleanVisibilityConverter(); // Act target.WhenTrue = expected; var actual = target.WhenTrue; // Assert Assert.AreEqual(expected, actual); }
public void WhenConvertCalledWithTrueThenWhenTrueReturned() { // Arrange var expected = Visibility.Collapsed; var value = true; var target = new BooleanVisibilityConverter(); target.WhenTrue = expected; // Act var actual = target.Convert(value, typeof(object), null, CultureInfo.InvariantCulture); // Assert Assert.AreEqual(expected, actual); }
public void BooleanVisibilityConverter_ConvertBack_DefaultParameters_ThrowException() { BooleanVisibilityConverter converter = new BooleanVisibilityConverter(); converter.ConvertBack(new Object(), typeof(SolidColorBrush), new Object(), CultureInfo.CurrentCulture); }