public void RandomizeAlpha_AdjustsAlpha() { // prereq MathTest.MathTest math = new MathTest.MathTest(); math.IsBetween_ReturnsCorrectAnswer(); // arrange Color color = new Color(0.1f, 0.2f, 0.3f, 0.5f); float variation = 0.25f; // act float min = 0.5f - variation; float max = 0.5f + variation; color = Palette.RandomizeAlpha(color, variation); // assert Assert.AreNotEqual(0.5f, color.a, "Does not always pass. Try running this test again."); Assert.IsTrue(color.a.IsBetween(min, max, true, true)); }
public void RandomizeSaturation_AdjustsColor() { // prereq MathTest.MathTest math = new MathTest.MathTest(); math.IsBetween_ReturnsCorrectAnswer(); // arrange Color color = new Color(0.1f, 0.2f, 0.3f); float variation = 0.1f; // act float minR = color.r; float maxR = minR + (1 - color.r) * variation; color = Palette.RandomizeSaturation(color, variation); // assert Assert.AreNotEqual(0.1f, color.r); Assert.IsTrue(color.r.IsBetween(minR, maxR)); }