示例#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"));
 }