private static void WriteElementStart(TextWriter writer,
            string elementName,
            Color foreground,
            Color background,
            bool italic = false,
            bool bold = false
            )
        {
            writer.Write("<{0}", elementName);

            if (foreground != Color.Empty || background != Color.Empty || italic || bold)
            {
                writer.Write(" style=\"");

                if (foreground != Color.Empty)
                    writer.Write("color:{0};", foreground.ToHtmlColor());

                if (background != Color.Empty)
                    writer.Write("background-color:{0};", background.ToHtmlColor());

                if (italic)
                    writer.Write("font-style: italic;");

                if (bold)
                    writer.Write("font-weight: bold;");

                writer.Write("\"");
            }

            writer.Write(">");
        }
 public void New_Color_Is_Opaque()
 {
     var color = new Color(127, 244, 133);
     Assert.Equal(255, color.Alpha);
 }
 public void GetHashCode_Red_Matches_Equal_Objects()
 {
     var lhs = Color.Red;
     var rhs = new Color(255, 0, 0);
     Assert.Equal(lhs.GetHashCode(), rhs.GetHashCode());
 }
 public void GetHashCode_Green_Matches_Equal_Objects()
 {
     var lhs = Color.DarkGreen;
     var rhs = new Color(0, 100, 0);
     Assert.Equal(lhs.GetHashCode(), rhs.GetHashCode());
 }
 public void GetHashCode_Blue_Matches_Equal_Objects()
 {
     var lhs = Color.Blue;
     var rhs = new Color(0, 0, 255);
     Assert.Equal(lhs.GetHashCode(), rhs.GetHashCode());
 }
 public void Will_Equal_Same_Color()
 {
     var lhs = new Color(123, 111, 222);
     var rhs = new Color(123, 111, 222);
     Assert.True(lhs.Equals(rhs));
 }