예제 #1
0
 public BundlesHelper_Tests()
 {
     settings = new CassetteSettings();
     bundles = new BundleCollection(settings, Mock.Of<IFileSearchProvider>(), Mock.Of<IBundleFactoryProvider>(), Mock.Of<IBundleCollectionInitializer>());
     referenceBuilder = new Mock<IReferenceBuilder>();
     var urlModifier = new VirtualDirectoryPrepender("/");
     var urlGenerator = new UrlGenerator(urlModifier, new FakeFileSystem(), "cassette.axd/");
     helper = new BundlesHelper(bundles, settings, urlGenerator, () => referenceBuilder.Object, Mock.Of<IFileAccessAuthorization>(), Mock.Of<IBundleCacheRebuilder>(), new SimpleJsonSerializer());
 }
예제 #2
0
        public BundlesHelper_Tests()
        {
            settings         = new CassetteSettings();
            bundles          = new BundleCollection(settings, Mock.Of <IFileSearchProvider>(), Mock.Of <IBundleFactoryProvider>(), Mock.Of <IBundleCollectionInitializer>());
            referenceBuilder = new Mock <IReferenceBuilder>();
            var urlModifier  = new VirtualDirectoryPrepender("/");
            var urlGenerator = new UrlGenerator(urlModifier, new FakeFileSystem(), "cassette.axd/");

            helper = new BundlesHelper(bundles, settings, urlGenerator, () => referenceBuilder.Object, Mock.Of <IFileAccessAuthorization>(), Mock.Of <IBundleCacheRebuilder>(), new SimpleJsonSerializer());
        }
 public ExternalScriptBundleDeserializer_Tests()
 {
     element = new XElement(
         "ExternalScriptBundle",
         new XAttribute("Path", "~"),
         new XAttribute("Hash", "010203"),
         new XAttribute("Url", "http://example.com/"),
         new XAttribute("FallbackCondition", "CONDITION")
     );
     directory = new FakeFileSystem
     {
         { "~/script/010203.js", "content" }
     };
     var urlModifier = new VirtualDirectoryPrepender("/");
     reader = new ExternalScriptBundleDeserializer(urlModifier);
     DeserializeToBundle();
 }
        public ExternalScriptBundleDeserializer_Tests()
        {
            element = new XElement(
                "ExternalScriptBundle",
                new XAttribute("Path", "~"),
                new XAttribute("Hash", "010203"),
                new XAttribute("Url", "http://example.com/"),
                new XAttribute("FallbackCondition", "CONDITION")
                );
            directory = new FakeFileSystem
            {
                { "~/script/010203.js", "content" }
            };
            var urlModifier = new VirtualDirectoryPrepender("/");

            reader = new ExternalScriptBundleDeserializer(urlModifier);
            DeserializeToBundle();
        }
 public StylesheetBundleDeserializer_Tests()
 {
     mediaElement = new XElement("HtmlAttribute", new XAttribute("Name", "media"), new XAttribute("Value", "expected-media"));
     element = new XElement(
         "StylesheetBundle",
         new XAttribute("Path", "~"),
         new XAttribute("Hash", "010203"),
         new XAttribute("Condition", "expected-condition"),
         mediaElement
     );
     directory = new FakeFileSystem
     {
         { "~/stylesheet/010203.css", "content" }
     };
     var urlModifier = new VirtualDirectoryPrepender("/");
     reader = new StylesheetBundleDeserializer(urlModifier);
     DeserializeBundle();
 }
예제 #6
0
        public StylesheetBundleDeserializer_Tests()
        {
            mediaElement = new XElement("HtmlAttribute", new XAttribute("Name", "media"), new XAttribute("Value", "expected-media"));
            element      = new XElement(
                "StylesheetBundle",
                new XAttribute("Path", "~"),
                new XAttribute("Hash", "010203"),
                new XAttribute("Condition", "expected-condition"),
                mediaElement
                );
            directory = new FakeFileSystem
            {
                { "~/stylesheet/010203.css", "content" }
            };
            var urlModifier = new VirtualDirectoryPrepender("/");

            reader = new StylesheetBundleDeserializer(urlModifier);
            DeserializeBundle();
        }
        public ExternalStylesheetBundleDeserializer_Tests()
        {
            element = new XElement(
                "ExternalStylesheetBundle",
                new XAttribute("Path", "~"),
                new XAttribute("Hash", "010203"),
                new XAttribute("Url", "http://example.com/"),
                new XAttribute("Condition", "CONDITION"),
                new XElement("HtmlAttribute", new XAttribute("Name", "media"), new XAttribute("Value", "MEDIA"))
                );
            directory = new FakeFileSystem
            {
                { "~/stylesheet/010203.css", "content" }
            };
            var urlModifier = new VirtualDirectoryPrepender("/");

            reader = new ExternalStylesheetBundleDeserializer(urlModifier);

            DeserializeElement();
        }
        public ExternalStylesheetBundleDeserializer_Tests()
        {
            element = new XElement(
                "ExternalStylesheetBundle",
                new XAttribute("Path", "~"),
                new XAttribute("Hash", "010203"),
                new XAttribute("Url", "http://example.com/"),
                new XAttribute("Condition", "CONDITION"),
                new XElement("HtmlAttribute", new XAttribute("Name", "media"), new XAttribute("Value", "MEDIA"))
            );
            directory = new FakeFileSystem
            {
                { "~/stylesheet/010203.css", "content"}
            };
            var urlModifier = new VirtualDirectoryPrepender("/");

            reader = new ExternalStylesheetBundleDeserializer(urlModifier);

            DeserializeElement();
        }
예제 #9
0
        public ScriptBundleDeserializer_Tests()
        {
            element = new XElement("ScriptBundle",
                                   new XAttribute("Path", "~"),
                                   new XAttribute("Hash", "010203"),
                                   new XAttribute("Condition", "expected-condition"),
                                   new XAttribute("ContentType", "text/javascript"),
                                   new XAttribute("PageLocation", "PAGE-LOCATION"),
                                   new XElement("Asset", new XAttribute("Path", "~/asset-1"), new XAttribute("AssetCacheValidatorType", typeof(FileAssetCacheValidator).FullName)),
                                   new XElement("Asset", new XAttribute("Path", "~/asset-2"), new XAttribute("AssetCacheValidatorType", typeof(FileAssetCacheValidator).FullName)),
                                   new XElement("Reference", new XAttribute("Path", "~/reference-1")),
                                   new XElement("Reference", new XAttribute("Path", "~/reference-2")),
                                   new XElement(
                                       "HtmlAttribute",
                                       new XAttribute("Name", "type"),
                                       new XAttribute("Value", "text/javascript")
                                       ),
                                   new XElement(
                                       "HtmlAttribute",
                                       new XAttribute("Name", "attribute1"),
                                       new XAttribute("Value", "value1")
                                       ),
                                   new XElement(
                                       "HtmlAttribute",
                                       new XAttribute("Name", "attribute2"),
                                       new XAttribute("Value", "value2")
                                       )
                                   );

            directory = new FakeFileSystem
            {
                { "~/script/010203.js", "CONTENT" }
            };
            var urlModifier = new VirtualDirectoryPrepender("/");

            deserializer = new ScriptBundleDeserializer(urlModifier);

            DeserializeBundle();
        }
예제 #10
0
        public ScriptBundleDeserializer_Tests()
        {
            element = new XElement("ScriptBundle",
                new XAttribute("Path", "~"),
                new XAttribute("Hash", "010203"),
                new XAttribute("Condition", "expected-condition"),
                new XAttribute("ContentType", "text/javascript"),
                new XAttribute("PageLocation", "PAGE-LOCATION"),
                new XElement("Asset", new XAttribute("Path", "~/asset-1"), new XAttribute("AssetCacheValidatorType", typeof(FileAssetCacheValidator).FullName)),
                new XElement("Asset", new XAttribute("Path", "~/asset-2"), new XAttribute("AssetCacheValidatorType", typeof(FileAssetCacheValidator).FullName)),
                new XElement("Reference", new XAttribute("Path", "~/reference-1")),
                new XElement("Reference", new XAttribute("Path", "~/reference-2")),
                new XElement(
                    "HtmlAttribute",
                    new XAttribute("Name", "type"),
                    new XAttribute("Value", "text/javascript")
                ),
                new XElement(
                    "HtmlAttribute",
                    new XAttribute("Name", "attribute1"),
                    new XAttribute("Value", "value1")
                ),
                new XElement(
                    "HtmlAttribute",
                    new XAttribute("Name", "attribute2"),
                    new XAttribute("Value", "value2")
                )
            );

            directory = new FakeFileSystem
            {
                { "~/script/010203.js", "CONTENT" }
            };
            var urlModifier = new VirtualDirectoryPrepender("/");
            deserializer = new ScriptBundleDeserializer(urlModifier);

            DeserializeBundle();
        }