public void ConvertTest() { var converter = new BoolToBrushConverter() { BrushIfFalse = new SolidColorBrush(Colors.Red), BrushIfTrue = new SolidColorBrush(Colors.Green) }; var actual = converter.Convert(false, null, null, CultureInfo.InvariantCulture); Assert.AreSame(converter.BrushIfFalse, actual); actual = converter.Convert(true, null, null, CultureInfo.InvariantCulture); Assert.AreSame(converter.BrushIfTrue, actual); }
public void WhenCalledConvert_ReturnsCorrectBrush() { var brushTrue = new SolidColorBrush(Colors.Black); var brushFalse = new SolidColorBrush(Colors.Red); var boolToBrushConverter = new BoolToBrushConverter {BrushIfFalse = brushFalse, BrushIfTrue = brushTrue}; Assert.AreEqual(brushFalse, boolToBrushConverter.Convert(false, null, null, null)); Assert.AreEqual(brushTrue, boolToBrushConverter.Convert(true, null, null, null)); }