Beispiel #1
0
        public void TestMapInverseShouldReturnDescendingValuesWithTwoValues(string value, byte red, byte green, byte blue)
        {
            _sourceValues = new List <string> {
                "A", "Z"
            };

            _map = new StringToColorMap(_sourceValues, _colorPalette.Colors, SortOrder.Descending);

            var color  = new Color(red, green, blue);
            var result = _map.MapInverse(color);

            Assert.That(result, Is.EqualTo(value));
        }
Beispiel #2
0
        public void TestMapShouldReturnCorrectValuesWithFourValues(string value, byte red, byte green, byte blue)
        {
            _sourceValues = new List <string> {
                "A", "B", "C", "D"
            };

            _map = new StringToColorMap(_sourceValues, _colorPalette.Colors, SortOrder.Ascending);

            var color  = new Color(red, green, blue);
            var result = _map.Map(value);

            Assert.That(result, Is.EqualTo(color));
        }
Beispiel #3
0
        public void SetUp()
        {
            _sourceValues = new List <string> {
                "Apple", "Elephant", "Monkey", "Tiger", "Zebra"
            };

            _colorPalette = new ColorPaletteBuilder()
                            .WithColor(Color.FromRgb(255, 0, 0))
                            .WithColor(Color.FromRgb(0, 255, 0))
                            .WithColor(Color.FromRgb(0, 0, 255))
                            .WithColor(Color.FromRgb(255, 255, 255))
                            .Build();

            _map = new StringToColorMap(_sourceValues, _colorPalette.Colors, SortOrder.Ascending);
        }