コード例 #1
0
        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.");
        }
コード例 #2
0
        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);
        }