1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 22:55:42 +00:00

test: cover Color.Deconstruct

This commit is contained in:
Oliver Booth 2023-03-28 15:54:06 +01:00
parent 3bc2ae45c7
commit 3e4d9603c0
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025

View File

@ -16,6 +16,54 @@ public class ColorTests
private static readonly Color Magenta = Color.FromArgb(255, 0, 255);
private static readonly Color Yellow = Color.FromArgb(255, 255, 0);
[TestMethod]
public void Deconstruct_ShouldDeconstructColor_GivenColor()
{
(byte r, byte g, byte b) = Black;
Assert.AreEqual(0, r);
Assert.AreEqual(0, g);
Assert.AreEqual(0, b);
(byte a, r, g, b) = Black;
Assert.AreEqual(255, a);
Assert.AreEqual(0, r);
Assert.AreEqual(0, g);
Assert.AreEqual(0, b);
(r, g, b) = Red;
Assert.AreEqual(255, r);
Assert.AreEqual(0, g);
Assert.AreEqual(0, b);
(a, r, g, b) = Red;
Assert.AreEqual(255, a);
Assert.AreEqual(255, r);
Assert.AreEqual(0, g);
Assert.AreEqual(0, b);
(r, g, b) = Green;
Assert.AreEqual(0, r);
Assert.AreEqual(255, g);
Assert.AreEqual(0, b);
(a, r, g, b) = Green;
Assert.AreEqual(255, a);
Assert.AreEqual(0, r);
Assert.AreEqual(255, g);
Assert.AreEqual(0, b);
(r, g, b) = Blue;
Assert.AreEqual(0, r);
Assert.AreEqual(0, g);
Assert.AreEqual(255, b);
(a, r, g, b) = Blue;
Assert.AreEqual(255, a);
Assert.AreEqual(0, r);
Assert.AreEqual(0, g);
Assert.AreEqual(255, b);
}
[TestMethod]
public void GetClosestConsoleColor_ShouldReturnClosestColor_GivenValidColor()
{