Exemplo n.º 1
0
        public void CreateBundleAssignsPipelineToBundleProcessor()
        {
            var factory = new ScriptBundleFactory(() => pipeline);
            var bundle  = factory.CreateBundle("~", Enumerable.Empty <IFile>(), new BundleDescriptor {
                AssetFilenames = { "*" }
            });

            bundle.Pipeline.ShouldBeSameAs(pipeline);
        }
Exemplo n.º 2
0
        public void CreateBundleAssignsSettingsDefaultProcessor()
        {
            var processor = new ScriptPipeline();

            settings.SetDefaultBundleProcessor(processor);
            var factory = new ScriptBundleFactory(settings);
            var bundle  = factory.CreateBundle("~", Enumerable.Empty <IFile>(), new BundleDescriptor {
                AssetFilenames = { "*" }
            });

            bundle.Processor.ShouldBeSameAs(processor);
        }
Exemplo n.º 3
0
        public void CreateBundleAssignsScriptBundleDirectory()
        {
            var factory = new ScriptBundleFactory();
            var bundle  = factory.CreateBundle(
                "~/test",
                Enumerable.Empty <IFile>(),
                new BundleDescriptor {
                AssetFilenames = { "*" }
            }
                );

            bundle.Path.ShouldEqual("~/test");
        }
Exemplo n.º 4
0
        public void CreateBundleReturnsScriptBundle()
        {
            var factory = new ScriptBundleFactory();
            var bundle  = factory.CreateBundle(
                "~/test",
                Enumerable.Empty <IFile>(),
                new BundleDescriptor {
                AssetFilenames = { "*" }
            }
                );

            bundle.ShouldBeType <ScriptBundle>();
        }
Exemplo n.º 5
0
        public void ShowFriendlyExceptionWhenTryingToCreateMinJsFileWhereNonMinJsExists()
        {
            var factory = new ScriptBundleFactory(() => pipeline);
            var file    = new Mock <IFile>();

            file.SetupGet(f => f.FullPath).Returns("~/test.js");
            var files     = new[] { file.Object };
            var exception = Record.Exception(
                () => factory.CreateBundle("~", files, new BundleDescriptor {
                AssetFilenames = { "~/test.min.js" }
            })
                );

            exception.Message.ShouldEqual("Bundle \"~\" references \"~/test.min.js\" when it should reference \"~/test.js\".");
        }
Exemplo n.º 6
0
        public void GivenDescriptorIsFromFile_WhenCreateBundle_ThenBundleIsFromDescriptorFileEqualsTrue()
        {
            var factory    = new ScriptBundleFactory(settings);
            var descriptor = new BundleDescriptor
            {
                IsFromFile     = true,
                AssetFilenames = { "*" }
            };
            var bundle = factory.CreateBundle(
                "~",
                Enumerable.Empty <IFile>(),
                descriptor
                );

            bundle.IsFromDescriptorFile.ShouldBeTrue();
        }
Exemplo n.º 7
0
        public void GivenDescriptorIsFromFile_WhenCreateBundle_ThenBundleIsFromDescriptorFileEqualsTrue()
        {
            var factory = new ScriptBundleFactory(() => pipeline);
            var file    = new Mock <IFile>();

            file.SetupGet(f => f.FullPath).Returns("~/bundle.txt");
            var descriptor = new BundleDescriptor
            {
                File           = file.Object,
                AssetFilenames = { "*" }
            };
            var bundle = factory.CreateBundle(
                "~",
                Enumerable.Empty <IFile>(),
                descriptor
                );

            bundle.IsFromDescriptorFile.ShouldBeTrue();
        }