public void CreateBundleReturnsScriptBundle() { var factory = new ScriptBundleFactory(); var bundle = factory.CreateBundle( "~/test", Enumerable.Empty<IFile>(), new BundleDescriptor { AssetFilenames = { "*" } } ); bundle.ShouldBeType<ScriptBundle>(); }
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); }
public void CreateBundleAssignsScriptBundleDirectory() { var factory = new ScriptBundleFactory(); var bundle = factory.CreateBundle( "~/test", Enumerable.Empty<IFile>(), new BundleDescriptor { AssetFilenames = { "*" } } ); bundle.Path.ShouldEqual("~/test"); }
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); }
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\"."); }
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(); }
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(); }
public void CreateBundleAssignsPipelineToBundleProcessor() { var factory = new ScriptBundleFactory(() => pipeline); var bundle = factory.CreateBundle("~", Enumerable.Empty<IFile>(), new BundleDescriptor { AssetFilenames = { "*" } }); bundle.Pipeline.ShouldBeSameAs(pipeline); }