public void Convert_NullValue_NullNegateValue() { BoolToVisibilityConverter converter = new BoolToVisibilityConverter(); Visibility visibility = (Visibility)converter.Convert(null, typeof(Visibility), null, null); Assert.IsTrue(visibility == Visibility.Collapsed); visibility = (Visibility)converter.Convert((bool?)null, typeof(Visibility), null, null); Assert.IsTrue(visibility == Visibility.Collapsed); }
/// <summary> /// Tests the converter when converting a false value and not specifying whether or not to negate that value /// </summary> public void Convert_FalseValue_NullNegateValue() { bool boolVal = false; bool? nullableBoolVal = false; BoolToVisibilityConverter converter = new BoolToVisibilityConverter(); Visibility visibility = (Visibility)converter.Convert(boolVal, typeof(Visibility), null, null); Assert.IsTrue(visibility == Visibility.Collapsed); visibility = (Visibility)converter.Convert(nullableBoolVal, typeof(Visibility), null, null); Assert.IsTrue(visibility == Visibility.Collapsed); }
public void Convert_InvalidTargetType() { BoolToVisibilityConverter converter = new BoolToVisibilityConverter(); converter.Convert(true, typeof(Uri), null, null); }
public void Convert_NullTargetType() { BoolToVisibilityConverter converter = new BoolToVisibilityConverter(); converter.Convert(true, null, null, null); }
/// <summary> /// Tests the converter when converting a false value and specifically negating that value /// </summary> public void Convert_FalseValue_TrueNegateValue() { foreach (object truthinessObject in _trueValues) { bool boolVal = false; bool? nullableBoolVal = false; BoolToVisibilityConverter converter = new BoolToVisibilityConverter(); Visibility visibility = (Visibility)converter.Convert(boolVal, typeof(Visibility), truthinessObject, null); Assert.IsTrue(visibility == Visibility.Visible); visibility = (Visibility)converter.Convert(nullableBoolVal, typeof(Visibility), truthinessObject, null); Assert.IsTrue(visibility == Visibility.Visible); } }
public void Convert_TrueValue_FalseNegateValue() { bool boolVal = true; bool? nullableBoolVal = true; BoolToVisibilityConverter converter = new BoolToVisibilityConverter(); Visibility visibility = (Visibility)converter.Convert(boolVal, typeof(Visibility), false, null); Assert.IsTrue(visibility == Visibility.Visible); visibility = (Visibility)converter.Convert(nullableBoolVal, typeof(Visibility), false, null); Assert.IsTrue(visibility == Visibility.Visible); }