private static void Output(HtmlStyleAttributeCollection styles) { foreach (HtmlStyleAttribute style in styles) { Console.WriteLine("{0}: {1}; Expression: {2}, Value: {3}", style.Key, style.Value, style.Expression.Expression, style.Expression.Value); } }
public void OneStyleTest() { string style = "color:red"; HtmlStyleAttributeCollection result = HtmlStyleParser.Parse(style); Output(result); Console.WriteLine(result.Join()); Assert.AreEqual(1, result.Count); Assert.AreEqual("red", result["color"].Value); }
public void TwoStyleWithoutLastValueTest() { string style = " color: red; font-weight"; HtmlStyleAttributeCollection result = HtmlStyleParser.Parse(style); Output(result); Console.WriteLine(result.Join()); Assert.AreEqual(2, result.Count); Assert.AreEqual("red", result["color"].Value); Assert.AreEqual(null, result["font-weight"].Value); }