public void RgbGradientGenerator_CalculatePercent_CalculatesMultiplePercents(double value, double minValue, double maxValue, double expected) { // Arrange var generator = new RgbGradientGenerator(); // Act var percent = generator.CalculatePercent(value, minValue, maxValue); // Assert Assert.AreEqual(expected, percent); }
public void RgbGradientGenerator_GetColorFromPercent_TransformsPercentsInColors(double percent, int expectedR, int expectedG, int expectedB) { // Arrange var generator = new RgbGradientGenerator(); // Act var color = generator.GetColorFromPercent(percent); // Assert Assert.AreEqual(expectedR, color.R); Assert.AreEqual(expectedG, color.G); Assert.AreEqual(expectedB, color.B); }
public void RgbGradientGenerator_GetColorForValueInRange_GeneratesColor() { // Arrange var generator = new RgbGradientGenerator(); var lowGradientColor = Color.FromArgb(0, 127, 0); var midGradientColor = Color.FromArgb(128, 63, 0); var highGradientColor = Color.FromArgb(255, 0, 0); // Act var lowColor = generator.GetColorForValueInRange(20, 20, 30); var midColor = generator.GetColorForValueInRange(25, 20, 30); var highColor = generator.GetColorForValueInRange(30, 20, 30); // Assert Assert.AreEqual(lowGradientColor, lowColor); Assert.AreEqual(midGradientColor, midColor); Assert.AreEqual(highGradientColor, highColor); }