public void RemoteScriptGroupAddTest() { var scriptGroup = new RemoteScriptGroup(); var path = "path/to/script"; var script1 = new LinkedScript(path); var script2 = new LinkedScript(path); scriptGroup.Add(script1); try { scriptGroup.Add(script2); } catch (ResourceAlreadyAddedException) { return; } catch (Exception) { Assert.Fail("Incorrect exception thrown."); } Assert.Fail("No exception thrown."); }
public void LinkedScriptConstructorTest() { var path = "path/to/script"; var script = new LinkedScript(path); Assert.AreEqual(path, script.Source); }
public void LinkedEqualsInlineTest() { var script1 = new LinkedScript("path/to/script"); var script2 = new InlineScript("path/to/script"); Assert.IsFalse(script1.Equals(script2)); Assert.IsFalse(script2.Equals(script1)); }
public void LinkedEqualsLinkedTest2() { var script1 = new LinkedScript("path/to/script1"); var script2 = new LinkedScript("path/to/script2"); Assert.IsFalse(script1.Equals(script2)); Assert.IsFalse(script2.Equals(script1)); }
public void LinkedEqualsInlineTest2() { var script1 = new LinkedScript("path/to/script"); var script2 = new InlineScript("path/to/script"); var obj = (object)script2; Assert.IsFalse(script1.Equals(obj)); Assert.IsFalse(obj.Equals(script1)); }
public void LinkedEqualsLinkedTest3() { var script1 = new LinkedScript("path/to/script"); var script2 = new LinkedScript("path/to/script"); var obj = (object)script2; Assert.IsTrue(script1.Equals(obj)); Assert.IsTrue(obj.Equals(script1)); }
public void LinkedScriptRenderTest() { var path = "path/to/script"; var script = new LinkedScript(path); var render = script.Render(); var expected = "<script type=\"text/javascript\" src=\"" + path + "\"></script>"; Assert.AreEqual(expected, render); }
public void RemoteScriptGroupRegisterTest() { var scriptGroup = new RemoteScriptGroup(); var path = "path/to/script"; var script1 = new LinkedScript(path); var script2 = new LinkedScript(path); scriptGroup.Register(script1); scriptGroup.Register(script2); Assert.AreEqual(1, scriptGroup.Count); }
public void RemoteScriptGroupHasRegisteredTest() { var scriptGroup = new RemoteScriptGroup(); var path = "path/to/script"; var script1 = new LinkedScript(path); var script2 = new LinkedScript(path); Assert.IsFalse(scriptGroup.HasRegistered(script1)); Assert.IsFalse(scriptGroup.HasRegistered(script2)); scriptGroup.Register(script1); Assert.IsTrue(scriptGroup.HasRegistered(script1)); Assert.IsTrue(scriptGroup.HasRegistered(script2)); }
public void RemoteScriptGroupRenderTest() { var scriptGroup = new RemoteScriptGroup(); var path1 = "//path/to/script1"; var path2 = "//path/to/script2"; var script1 = new LinkedScript(path1); var script2 = new LinkedScript(path2); scriptGroup.Add(script1); scriptGroup.Add(script2); Func <string, string> renderTest = s => "<script type=\"text/javascript\" src=\"" + s + "\"></script>"; var render = scriptGroup.Render(); var expected = renderTest(path1) + Environment.NewLine + renderTest(path2); Assert.AreEqual(expected, render); }