Пример #1
0
        public void BuildToHex_ShouldCreateAColorInHex(string phrase, string hexExpected)
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.BuildToHex(phrase);

            Assert.NotNull(result);
            Assert.Equal(hexExpected, result);
        }
Пример #2
0
        public void BuildToColor_ShouldCreateAColorObject()
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.BuildToColor("yoda");

            Assert.Equal(Color.FromArgb(alpha: 255, red: 104, green: 120, blue: 58),
                         result);
        }
Пример #3
0
        public void Hex_ShouldCreateAColorInHex()
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.BuildToHex("Hello World");

            Assert.NotNull(result);
            Assert.Equal("8796C5", result);
        }
Пример #4
0
        public void Rgb_ShouldCreateAColorInRgb()
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.Rgb("Hello World");

            Assert.Equal(135, result.R);
            Assert.Equal(150, result.G);
            Assert.Equal(197, result.B);
        }
Пример #5
0
        public void BuildToHsl_HelloWorldString()
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.BuildToHsl("Hello World");

            Assert.NotNull(result);
            Assert.Equal(225, result.H);
            Assert.Equal(0.35, result.S);
            Assert.Equal(0.65, result.L);
        }
Пример #6
0
        public void BuildToHsl_ShouldCreateAColorWithHSL()
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.BuildToHsl("yoda");

            Assert.NotNull(result);
            Assert.Equal(76, result.H);
            Assert.Equal(0.35, result.S);
            Assert.Equal(0.35, result.L);
        }
Пример #7
0
        public void Hsl_ShouldCreateAColorInHSL()
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.Hsl("Hello World");

            Assert.NotNull(result);
            Assert.Equal(225, result.H);
            Assert.Equal(0.35, result.S);
            Assert.Equal(0.65, result.L);
        }
Пример #8
0
        public void BuildToHsl_ShouldCreateAColorInHSL(
            string phrase, double hExpected, double sExpected, double lExpected)
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.BuildToHsl(phrase);

            Assert.NotNull(result);
            Assert.Equal(hExpected, result.H);
            Assert.Equal(sExpected, result.S);
            Assert.Equal(lExpected, result.L);
        }
Пример #9
0
        public void Build_HelloWorldStringToHslColorAndHex()
        {
            var ColorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var resultHsl   = ColorHash.BuildToHsl("Hello World");
            var resultColor = ColorHash.BuildToColor("Hello World");
            var resultHex   = ColorHash.BuildToHex("Hello World");

            Assert.Equal(135, resultColor.R);
            Assert.Equal(150, resultColor.G);
            Assert.Equal(197, resultColor.B);

            Assert.Equal(225, resultHsl.H);
            Assert.Equal(0.35, resultHsl.S);
            Assert.Equal(0.65, resultHsl.L);

            Assert.Equal("8796C5", resultHex);
        }