public void CssTest() { var target = new Media_Accessor(); target._cssDirty = true; target._cssOutput = null; target.AddCss("http://example.com/test.css"); Assert.AreEqual("<link href=\"http://example.com/test.css\" type=\"text/css\" rel=\"stylesheet\" />", target.Css); target._cssDirty = true; target._cssOutput = "Test"; Assert.AreEqual("<link href=\"http://example.com/test.css\" type=\"text/css\" rel=\"stylesheet\" />", target.Css); target._cssDirty = false; target._cssOutput = "Test"; Assert.AreEqual("Test", target.Css); target.AddCss("http://example.com/test2.css", CssMediaTypes.Print); target._cssDirty = false; target._cssOutput = null; Assert.AreEqual("<link href=\"http://example.com/test.css\" type=\"text/css\" rel=\"stylesheet\" />\n" + "<link href=\"http://example.com/test2.css\" type=\"text/css\" media=\"print\" rel=\"stylesheet\" />", target.Css); }
public void AddCssTest1() { Media_Accessor target = new Media_Accessor(); const string cssExternalFile = "http://example.com/myfile.css"; const string cssLocalFile = "local.css"; target._cssDirty = false; target.AddCss(cssExternalFile, CssMediaTypes.None); Assert.AreEqual(1, target._css.Count); Assert.AreEqual(CssMediaTypes.None, target._css[cssExternalFile]); Assert.IsTrue(target._cssDirty); target._cssDirty = false; target.AddCss(cssExternalFile, CssMediaTypes.Projection); Assert.AreEqual(1, target._css.Count); Assert.AreEqual(CssMediaTypes.Screen | CssMediaTypes.Projection, target._css[cssExternalFile]); Assert.IsTrue(target._cssDirty); target._cssDirty = false; target.AddCss(cssLocalFile, CssMediaTypes.Handheld); Assert.AreEqual(2, target._css.Count); Assert.AreEqual(CssMediaTypes.Handheld, target._css[cssLocalFile]); Assert.IsTrue(target._cssDirty); target._cssDirty = false; target.AddCss(cssLocalFile, CssMediaTypes.Tty); Assert.AreEqual(2, target._css.Count); Assert.AreEqual(CssMediaTypes.Handheld | CssMediaTypes.Tty, target._css[cssLocalFile]); Assert.IsTrue(target._cssDirty); }
public void AddCssTest() { Media_Accessor target = new Media_Accessor(); target._cssDirty = false; target.AddCss("http://example.com/myfile.css"); Assert.AreEqual(1, target._css.Count); Assert.IsTrue(target._cssDirty); target._cssDirty = false; target.AddCss("http://example.com/myfile.css"); Assert.AreEqual(1, target._css.Count); Assert.IsTrue(target._cssDirty); target._cssDirty = false; target.AddCss("local.css"); Assert.AreEqual(2, target._css.Count); Assert.IsTrue(target._cssDirty); }
public void ToStringTest() { var target = new Media_Accessor(); // External references used to avoid virtual path provider target .AddCss("http://example.com/test.css") .AddJS("http://example.com/test.js"); Assert.AreEqual("<link href=\"http://example.com/test.css\" type=\"text/css\" rel=\"stylesheet\" />\n" + "<script src=\"http://example.com/test.js\" type=\"text/javascript\"></script>", target.ToString()); }