コード例 #1
0
        public void LocalScriptGroupRegisterTest()
        {
            var scriptGroup = new LocalScriptGroup();

            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);
        }
コード例 #2
0
        public void LocalScriptGroupRegisterTest2()
        {
            var scriptGroup = new LocalScriptGroup {
                Helper = new MockLocalHelper()
            };

            var script1 = "~/Scripts/Script1.js";
            var script2 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/Scripts/Script1.js";

            scriptGroup.Register(script1, script2);

            Assert.AreEqual(1, scriptGroup.Count);
        }
コード例 #3
0
        public void LocalScriptGroupHasRegisteredTest()
        {
            var scriptGroup = new LocalScriptGroup();

            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));
        }
コード例 #4
0
        public void LocalScriptGroupRegisterTest3()
        {
            var scriptGroup = new LocalScriptGroup {
                Helper = new MockLocalHelper()
            };

            var script = "~/Scripts/DoesNotExist.js";

            try
            {
                scriptGroup.Register(script);
            }
            catch (ResourceNotFoundException)
            {
                return;
            }
            catch (Exception)
            {
                Assert.Fail("Wrong exception thrown.");
            }

            Assert.Fail("No exception thrown.");
        }