public void ExecuteDrawingInstructionPassNull() { var color = new ARGBColor(100, 100, 100, 100); var instruction = new ChangeBackgroundInstruction(color); Assert.Throws <ArgumentNullException>(() => instruction.ExecuteDrawingInstruction(null)); }
public void CtorArgbColor() { var color = new ARGBColor(100, 100, 100, 100); var instruction = new ChangeBackgroundInstruction(color); Assert.Equal(instruction.Background, color); }
public void ToStringTest() { var color = new ARGBColor(78, 123, 255, 18); var expected = $"A:{color.A}, R:{color.R}, G:{color.G}, B:{color.B}"; var result = color.ToString(); Assert.Equal(expected, result); }
public void Ctor_ValidDataTheory(byte a, byte r, byte g, byte b) { var color = new ARGBColor(a, r, g, b); Assert.Equal(a, color.A); Assert.Equal(r, color.R); Assert.Equal(g, color.G); Assert.Equal(b, color.B); }
public void EqualityEquals() { var color = new ARGBColor(78, 123, 255, 18); var anotherColor = new ARGBColor(78, 123, 255, 18); var result = color.Equals(anotherColor); Assert.True(result); }
public void OverriddenEquals() { var color = new ARGBColor(78, 123, 255, 18); var anotherColor = (object)new ARGBColor(78, 123, 255, 18); var result = color.Equals(anotherColor); Assert.True(result); }
public void NonEqualityOperator() { var color = new ARGBColor(78, 123, 255, 18); var anotherColor = new ARGBColor(78, 123, 255, 18); var result = color != anotherColor; Assert.False(result); }
public void GetHashCodeForNonEqualColors() { var color = new ARGBColor(78, 123, 255, 18); var anotherColor = new ARGBColor(53, 188, 0, 13); var hashCode = color.GetHashCode(); var anotherHashCode = anotherColor.GetHashCode(); Assert.NotEqual(hashCode, anotherHashCode); }
public void FromColor() { var yellow = Colors.Yellow; var result = ARGBColor.FromColor(yellow); Assert.Equal(yellow.A, result.A); Assert.Equal(yellow.R, result.R); Assert.Equal(yellow.G, result.G); Assert.Equal(yellow.B, result.B); }
public void ExecuteDrawingInstruction() { var repositoryMock = new Mock <IDrawingInstructionRepository>(); var color = new ARGBColor(100, 100, 100, 100); var instruction = new ChangeBackgroundInstruction(color); instruction.ExecuteDrawingInstruction(repositoryMock.Object); repositoryMock.Verify(mock => mock.ChangeBackground(instruction), Times.Once); }
public void AsColor() { var yellow = Colors.Yellow; var color = new ARGBColor { A = yellow.A, R = yellow.R, G = yellow.G, B = yellow.B }; var result = color.AsColor(); Assert.Equal(yellow, result); }
internal static Color FromIColor(IColor color) { if (null == color) { return(null); } ARGBColor c = color as ARGBColor; if (null != c) { return(c); } return(Color.ByARGB(color.AlphaValue, color.RedValue, color.GreenValue, color.BlueValue)); }
public override void UpdateSensorResponse(ProtocolArray responseData) { if (SensorType == SensorType.COLOR_FULL) { RawValue = (int)responseData.GetBits(1, 3); colorData = new ARGBColor( (int)responseData.GetBits(1, 10), (int)responseData.GetBits(1, 10), (int)responseData.GetBits(1, 10), (int)responseData.GetBits(1, 10)); } else { base.UpdateSensorResponse(responseData); } }
public static SerializableStroke FromStroke(Stroke stroke) { if (stroke == null) { throw new ArgumentNullException(nameof(stroke)); } var attr = new StrokeAttributes { Color = ARGBColor.FromColor(stroke.DrawingAttributes.Color), Height = stroke.DrawingAttributes.Height, Width = stroke.DrawingAttributes.Width, IgnorePressure = stroke.DrawingAttributes.IgnorePressure, IsHighlighter = stroke.DrawingAttributes.IsHighlighter, StylusTip = stroke.DrawingAttributes.StylusTip }; var points = stroke.StylusPoints.Select(point => point.ToPoint()).ToArray(); return(new SerializableStroke(attr, points)); }
public ChangeBackgroundInstruction(Color background) : this(ARGBColor.FromColor(background)) { }
public SnapshotInstruction(ARGBColor background, IEnumerable <SerializableStroke> strokes) { Background = background; Strokes = strokes ?? throw new ArgumentNullException(nameof(strokes)); }
public ChangeBackgroundInstruction(ARGBColor background) { Background = background; }