public void Test_ConvertFalseToVisibilityWithNegateFalse() { var converter = new BoolToObjectConverter { TrueValue = Visibility.Visible, FalseValue = Visibility.Collapsed }; var result = converter.Convert(false, typeof(Visibility), "false", "en-us"); Assert.AreEqual(Visibility.Collapsed, result); }
public void Test_ConvertTrueToVisibility() { var converter = new BoolToObjectConverter { TrueValue = Visibility.Visible, FalseValue = Visibility.Collapsed }; var result = converter.Convert(true, typeof(Visibility), null, "en-us"); Assert.AreEqual(Visibility.Visible, result); }
public void Test_ConvertBackCollapseWithNegateTrue() { var converter = new BoolToObjectConverter { TrueValue = Visibility.Visible, FalseValue = Visibility.Collapsed }; var result = converter.ConvertBack(Visibility.Collapsed, typeof(bool), "true", "en-us"); Assert.AreEqual(true, result); }
public void BoolToObjectConvertBack(object value, object trueObject, object falseObject, bool expectedResult) { var boolObjectConverter = new BoolToObjectConverter(); boolObjectConverter.TrueObject = trueObject; boolObjectConverter.FalseObject = falseObject; var result = boolObjectConverter.ConvertBack(value, typeof(BoolToObjectConverter_Tests), null, CultureInfo.CurrentCulture); Assert.AreEqual(result, expectedResult); }
public void Test_ConvertBackRefTypeWithTypeConversion2() { var converter = new BoolToObjectConverter { TrueValue = "ms-appx:///Assets/True.png", FalseValue = "ms-appx:///Assets/False.png" }; var result = converter.ConvertBack(converter.FalseValue, typeof(bool), null, "en-us"); Assert.AreEqual(false, result); }
public void Test_ConvertBackBrush2() { var greenBrush = new SolidColorBrush(Colors.Green); var redBrush = new SolidColorBrush(Colors.Red); var converter = new BoolToObjectConverter { TrueValue = greenBrush, FalseValue = redBrush }; var result = converter.ConvertBack(redBrush, typeof(bool), null, "en-us"); Assert.AreEqual(false, result); }
public void Test_ConvertTrueToBrushWithTypeConversion() { var converter = new BoolToObjectConverter { TrueValue = "Green", FalseValue = "Red" }; var result = converter.Convert(true, typeof(Brush), null, "en-us"); Assert.IsInstanceOfType(result, typeof(SolidColorBrush)); Assert.AreEqual(Colors.Green, ((SolidColorBrush)result).Color); }
public void Test_ConvertTrueToBitmapImageWithTypeConversion() { var converter = new BoolToObjectConverter { TrueValue = "ms-appx:///Assets/True.png", FalseValue = "ms-appx:///Assets/False.png" }; var result = converter.Convert(true, typeof(ImageSource), null, "en-us"); Assert.IsInstanceOfType(result, typeof(BitmapImage)); Assert.AreEqual(converter.TrueValue, ((BitmapImage)result).UriSource.ToString()); }
public void Test_ConvertTrueToBrush() { var greenBrush = new SolidColorBrush(Colors.Green); var redBrush = new SolidColorBrush(Colors.Red); var converter = new BoolToObjectConverter { TrueValue = greenBrush, FalseValue = redBrush }; var result = converter.Convert(true, typeof(Brush), null, "en-us"); Assert.AreEqual(greenBrush, result); }
public BoolToObjectConverterTests() { m_boolToObjectConverter = new BoolToObjectConverter(); }
public void BoolToObjectInValidValuesThrowArgumenException(object value) { var boolObjectConverter = new BoolToObjectConverter(); Assert.Throws <ArgumentException>(() => boolObjectConverter.Convert(value, typeof(BoolToObjectConverter_Tests), null, CultureInfo.CurrentCulture)); }