示例#1
0
        public void DependencyAttributeWithoutSemicolonAtTheEndIsStillParsed()
        {
            var resource = StubResource.WithContent(@"/* dependency:url(~/styles/mystylesheet.css) */");

            var dependencies = _provider.GetDependencies(resource).ToList();

            dependencies.CountShouldEqual(1);
            dependencies[0].ShouldEqual("~/styles/mystylesheet.css");
        }
示例#2
0
        public void WhenReferencePathPointsToVsDocFile_VsDocPartIsRemoved()
        {
            var resource = StubResource.WithContent(@"///<reference path=""~/scripts/jquery-1.4.4-vsdoc.js"" />");

            var dependencies = _provider.GetDependencies(resource).ToList();

            dependencies.CountShouldEqual(1);
            dependencies[0].ShouldEqual("~/scripts/jquery-1.4.4.js");
        }
示例#3
0
        public void DependencyAttributeWithAppRelativeUrlIsParsedAsDependency()
        {
            var resource = StubResource.WithContent(@"/* dependency:url(~/styles/mystylesheet.css); */");

            var dependencies = _provider.GetDependencies(resource).ToList();

            dependencies.CountShouldEqual(1);
            dependencies[0].ShouldEqual("~/styles/mystylesheet.css");
        }
示例#4
0
        public void ReferenceElementeWithNameButMissingAssemblyAttributeReturnsEmbeddedResourceVirtualPathForSystemWebExtensionsAssembly()
        {
            var resource = StubResource.WithContent(@"///<reference name=""MicrosoftAjax.js"" />");

            var dependencies = _provider.GetDependencies(resource).ToList();

            dependencies.CountShouldEqual(1);
            dependencies[0].ShouldEqual("assembly://System.Web.Extensions/MicrosoftAjax.js");
        }
示例#5
0
        public void ReferenceElementWithNameAndAssemblyAttributeReturnsEmbeddedResourceVirtualPath()
        {
            var resource = StubResource.WithContent(@"///<reference name=""MyScript.js"" assembly=""MyAssembly"" />");

            var dependencies = _provider.GetDependencies(resource).ToList();

            dependencies.CountShouldEqual(1);
            dependencies[0].ShouldEqual("assembly://MyAssembly/MyScript.js");
        }
示例#6
0
        public void TripleWackCommentReferenceElementWithPathAttributeIsParsedAsDependency()
        {
            var resource = StubResource.WithContent(@"///<reference path=""~/scripts/jquery.js"" />");

            var dependencies = _provider.GetDependencies(resource).ToList();

            dependencies.CountShouldEqual(1);
            dependencies[0].ShouldEqual("~/scripts/jquery.js");
        }
示例#7
0
        public void WhenReferencePathIsRelative_ItIsResolvedRelativeToTheResource()
        {
            var resource = StubResource.WithContent(@"/* dependency:url(../styles/mystylesheet.css); */");

            resource.VirtualPath = "~/Content/MyStylsheet.css";

            var dependencies = _provider.GetDependencies(resource).ToList();

            dependencies.CountShouldEqual(1);
            dependencies[0].ShouldEqual("~/styles/mystylesheet.css");
        }
示例#8
0
        public void WhenReferencePathIsRelative_ItIsResolvedRelativeToTheResource()
        {
            var resource = StubResource.WithContent(@"///<reference path=""../Shared/MyComponent.js"" />");

            resource.VirtualPath = "~/Views/MyController/MyView.js";

            var dependencies = _provider.GetDependencies(resource).ToList();

            dependencies.CountShouldEqual(1);
            dependencies[0].ShouldEqual("~/Views/Shared/MyComponent.js");
        }
示例#9
0
        public void MultipleDependenciesAreRecognized()
        {
            var resource = StubResource.WithContent(@"/* dependency:url(~/styles/mystylesheet.css);

				dependency:url(~/styles/myotherstylesheet.css);*/"                );

            var dependencies = _provider.GetDependencies(resource).ToList();

            dependencies.CountShouldEqual(2);
            dependencies[0].ShouldEqual("~/styles/mystylesheet.css");
            dependencies[1].ShouldEqual("~/styles/myotherstylesheet.css");
        }
示例#10
0
        public void MultipleReferenceElementsAreRecognized()
        {
            var resource = StubResource.WithContent(@"///<reference path=""~/scripts/script1.js"" />

				///<reference path=""~/scripts/script2.js"" />"                );

            var dependencies = _provider.GetDependencies(resource).ToList();

            dependencies.CountShouldEqual(2);
            dependencies[0].ShouldEqual("~/scripts/script1.js");
            dependencies[1].ShouldEqual("~/scripts/script2.js");
        }