コード例 #1
0
 public void CreateBundleReturnsScriptBundle()
 {
     var factory = new ScriptBundleFactory();
     var bundle = factory.CreateBundle(
         "~/test",
         Enumerable.Empty<IFile>(),
         new BundleDescriptor { AssetFilenames = { "*" } }
     );
     bundle.ShouldBeType<ScriptBundle>();
 }
コード例 #2
0
        public JasmineBundleConfiguration_WhenConfigure()
        {
            var scriptBundleFactory = new ScriptBundleFactory(() => Mock.Of<IBundlePipeline<ScriptBundle>>());
            var stylesheetBundleFactory = new StylesheetBundleFactory(() => Mock.Of<IBundlePipeline<StylesheetBundle>>());
            var configuration = new JasmineBundleConfiguration(scriptBundleFactory, stylesheetBundleFactory);
            var settings = new CassetteSettings();
            bundles = new BundleCollection(settings, Mock.Of<IFileSearchProvider>(), Mock.Of<IBundleFactoryProvider>());

            configuration.Configure(bundles);
        }
コード例 #3
0
 public void CreateBundleAssignsScriptBundleDirectory()
 {
     var factory = new ScriptBundleFactory();
     var bundle = factory.CreateBundle(
         "~/test",
         Enumerable.Empty<IFile>(),
         new BundleDescriptor { AssetFilenames = { "*" } }
     );
     bundle.Path.ShouldEqual("~/test");
 }
コード例 #4
0
        public JasmineBundleConfiguration_WhenConfigure()
        {
            var scriptBundleFactory     = new ScriptBundleFactory(() => Mock.Of <IBundlePipeline <ScriptBundle> >());
            var stylesheetBundleFactory = new StylesheetBundleFactory(() => Mock.Of <IBundlePipeline <StylesheetBundle> >());
            var configuration           = new JasmineBundleConfiguration(scriptBundleFactory, stylesheetBundleFactory);
            var settings = new CassetteSettings();

            bundles = new BundleCollection(settings, Mock.Of <IFileSearchProvider>(), Mock.Of <IBundleFactoryProvider>());

            configuration.Configure(bundles);
        }
コード例 #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\".");
 }
コード例 #6
0
 public void GivenDescriptorIsFromFile_WhenCreateBundle_ThenBundleIsFromDescriptorFileEqualsTrue()
 {
     var factory = new ScriptBundleFactory();
     var descriptor = new BundleDescriptor
     {
         IsFromFile = true,
         AssetFilenames = { "*" }
     };
     var bundle = factory.CreateBundle(
         "~",
         Enumerable.Empty<IFile>(),
         descriptor
     );
     bundle.IsFromDescriptorFile.ShouldBeTrue();
 }
コード例 #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();
 }
コード例 #8
0
 public void CreateBundleAssignsPipelineToBundleProcessor()
 {
     var factory = new ScriptBundleFactory(() => pipeline);
     var bundle = factory.CreateBundle("~", Enumerable.Empty<IFile>(), new BundleDescriptor { AssetFilenames = { "*" } });
     bundle.Pipeline.ShouldBeSameAs(pipeline);
 }