public void EmbeddedStyleGroupRenderTest() { var style1 = new EmbeddedStyle("#world { color:blue; }"); var style2 = new EmbeddedStyle("#earth { color:green; }"); var styleGroup = new EmbeddedStyleGroup(); styleGroup.Add(style1); styleGroup.Add(style2); var rendered = styleGroup.Render(); var expected = "<style type=\"text/css\">"; expected += Environment.NewLine + "#world { color:blue; }"; expected += Environment.NewLine + "#earth { color:green; }"; expected += Environment.NewLine + "</style>"; Assert.AreEqual(expected, rendered); }
public void EmbeddedStyleGroupAddTest() { var styleGroup = new EmbeddedStyleGroup(); var source = "#style { color:red; }"; var style1 = new EmbeddedStyle(source); var style2 = new EmbeddedStyle(source); styleGroup.Add(style1); try { styleGroup.Add(style2); } catch (ResourceAlreadyAddedException) { return; } catch (Exception) { Assert.Fail("Incorrect exception thrown."); } Assert.Fail("No exception thrown."); }