예제 #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"));
 }