Пример #1
0
        public static void FromKeyword_GivenColorKeywordWithEnum_ReturnsRgbColorDefinition()
        {
            var rgb       = new Rgb(255, 69, 0);
            var orangeRed = Rgb.FromKeyword(ColorKeyword.OrangeRed);

            Assert.AreEqual(rgb, orangeRed);
        }
Пример #2
0
        public static void FromKeyword_GivenColorKeywordWithDifferentCase_ReturnsRgbColorDefinition()
        {
            var rgb       = new Rgb(255, 69, 0);
            var orangeRed = Rgb.FromKeyword("orAnGeRed");

            Assert.AreEqual(rgb, orangeRed);
        }
Пример #3
0
        public static void FromKeyword_GivenValidColorKeyword_ReturnsRgbColorDefinition()
        {
            var rgb       = new Rgb(255, 69, 0);
            var orangeRed = Rgb.FromKeyword("orangered");

            Assert.AreEqual(rgb, orangeRed);
        }
Пример #4
0
 public static void FromKeyword_GivenEmptyKeywordString_ThrowsArgNullException()
 {
     Assert.Multiple(() =>
     {
         Assert.Throws <ArgumentNullException>(() => Rgb.FromKeyword(null));
         Assert.Throws <ArgumentNullException>(() => Rgb.FromKeyword(string.Empty));
         Assert.Throws <ArgumentNullException>(() => Rgb.FromKeyword("   "));
     });
 }
Пример #5
0
        public static void FromKeyword_GivenColorKeywordWithInvalidEnum_ThrowsArgException()
        {
            const ColorKeyword badEnum = (ColorKeyword)293048;

            Assert.Throws <ArgumentException>(() => Rgb.FromKeyword(badEnum));
        }
Пример #6
0
 public static void FromKeyword_GivenUnknownColorKeyword_ThrowsArgOutOfRangeException()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => Rgb.FromKeyword("this_color_does_not_exist"));
 }