public void ConvertInvalidTypeReturnsUnset() { // Arrange var conv = new ColorToBrush(); // Act object converted = conv.Convert(string.Empty, null, null, null); // Assert Assert.AreEqual(DependencyProperty.UnsetValue, converted); }
public void Converter_ColorToBrushTests() { ColorToBrush conv = new ColorToBrush(); var convBrush = conv.Convert(Colors.White, typeof(Brush), null, CultureInfo.CurrentCulture); var brush = new SolidColorBrush(Colors.White); Assert.AreEqual(brush.Color, ((SolidColorBrush)convBrush).Color, "ColorToBrush Convert did not return the correct brush"); var clr = conv.ConvertBack(new SolidColorBrush(Colors.White), typeof(Color), null, CultureInfo.CurrentCulture); Assert.AreEqual(Colors.White, clr, "ColorToBrush ConvertBack did not return the correct color"); }
public void ConvertCreatesCorrectBrush() { // Arrange var conv = new ColorToBrush(); // Act object converted = conv.Convert(Colors.Yellow, null, null, null); // Assert SolidColorBrush brush = converted as SolidColorBrush; Assert.IsNotNull(brush); Assert.AreEqual(Colors.Yellow, brush.Color); }