public void TestThatPropertyChangeCalled(string prop, byte value) { NotifyableColor color = new NotifyableColor(Colors.Black); var property = color.GetType().GetProperty(prop); Assert.NotNull(property); Assert.PropertyChanged(color, prop, () => property.SetValue(color, value)); }
public ColorPicker() { InitializeComponent(); _colorPalette = FindName("colorPalette") as Image; _dispatcher = Application.Current.Dispatcher; NotifyableColor = new NotifyableColor(SelectedColor); NotifyableColor.ColorChanged += SelectedColor_ColorChanged; _colorPalette.IsVisibleChanged += _colorPalette_IsVisibleChanged; }
public void TestThatSetArgbWorks() { NotifyableColor color = new NotifyableColor(); color.SetArgb(2, 2, 2, 2); Assert.Equal(2, color.A); Assert.Equal(2, color.R); Assert.Equal(2, color.G); Assert.Equal(2, color.B); }
public void TestThatEventCalled(string prop, byte value) { bool eventCalled = false; NotifyableColor color = new NotifyableColor(Colors.Black); var property = color.GetType().GetProperty(prop); color.ColorChanged += (s, e) => eventCalled = true; Assert.NotNull(property); property.SetValue(color, value); Assert.True(eventCalled); }