public BundleCollection(CassetteSettings settings, IFileSearchProvider fileSearchProvider, IBundleFactoryProvider bundleFactoryProvider, IBundleCollectionInitializer bundleCollectionInitializer) { this.settings = settings; this.fileSearchProvider = fileSearchProvider; this.bundleFactoryProvider = bundleFactoryProvider; this.bundleCollectionInitializer = bundleCollectionInitializer; }
protected BundleCollectionTestsBase() { tempDirectory = new TempDirectory(); factory = new Mock <IBundleFactory <TestableBundle> >(); factory .Setup(f => f.CreateBundle(It.IsAny <string>(), It.IsAny <IEnumerable <IFile> >(), It.IsAny <BundleDescriptor>())) .Callback <string, IEnumerable <IFile>, BundleDescriptor>((path, files, descriptor) => FilesUsedToCreateBundle = files.Select(f => f.FullPath).ToArray()) .Returns <string, IEnumerable <IFile>, BundleDescriptor>( (path, files, d) => new TestableBundle(path) ); fileSearch = new Mock <IFileSearch>(); fileSearch .Setup(s => s.FindFiles(It.IsAny <IDirectory>())) .Returns <IDirectory>(d => d.GetFiles("*.*", SearchOption.AllDirectories)); settings = new CassetteSettings { SourceDirectory = new FileSystemDirectory(tempDirectory), }; bundleFactoryProvider = new Mock <IBundleFactoryProvider>(); bundleFactoryProvider .Setup(p => p.GetBundleFactory <TestableBundle>()) .Returns(factory.Object); var fileSearchProvider = new Mock <IFileSearchProvider>(); fileSearchProvider .Setup(p => p.GetFileSearch(It.IsAny <Type>())) .Returns(fileSearch.Object); bundles = new BundleCollection(settings, fileSearchProvider.Object, bundleFactoryProvider.Object); }
public FileSystemWatchingBundleRebuilder_Tests() { tempDirectory = new TempDirectory(); Directory.CreateDirectory(Path.Combine(tempDirectory, "cache")); var settings = new CassetteSettings { SourceDirectory = new FileSystemDirectory(tempDirectory), CacheDirectory = new FileSystemDirectory(Path.Combine(tempDirectory, "cache")), IsFileSystemWatchingEnabled = true }; bundles = new BundleCollection(settings, Mock.Of<IFileSearchProvider>(), Mock.Of<IBundleFactoryProvider>()); bundleConfiguration = new Mock<IConfiguration<BundleCollection>>(); var bundle = new TestableBundle("~"); var asset1 = new StubAsset("~/test.js"); var asset2 = new StubAsset("~/sub/test2.js"); asset1.AddRawFileReference("~/image.png"); bundle.Assets.Add(asset1); bundle.Assets.Add(asset2); bundles.Add(bundle); fileSearch = new Mock<IFileSearch>(); fileSearch .Setup(s => s.IsMatch(It.IsAny<string>())) .Returns<string>(path => path.EndsWith(".js")); var initializer = new BundleCollectionInitializer(new[] { bundleConfiguration.Object }, new ExternalBundleGenerator(Mock.Of<IBundleFactoryProvider>(), settings)); rebuilder = new FileSystemWatchingBundleRebuilder(settings, bundles, initializer, new[] { fileSearch.Object }); }
public FileSystemWatchingBundleRebuilder_Tests() { tempDirectory = new TempDirectory(); Directory.CreateDirectory(Path.Combine(tempDirectory, "cache")); var settings = new CassetteSettings { SourceDirectory = new FileSystemDirectory(tempDirectory), CacheDirectory = new FileSystemDirectory(Path.Combine(tempDirectory, "cache")), IsFileSystemWatchingEnabled = true }; bundles = new BundleCollection(settings, Mock.Of <IFileSearchProvider>(), Mock.Of <IBundleFactoryProvider>(), Mock.Of <IBundleCollectionInitializer>()); bundleConfiguration = new Mock <IConfiguration <BundleCollection> >(); var bundle = new TestableBundle("~"); var asset1 = new StubAsset("~/test.js"); var asset2 = new StubAsset("~/sub/test2.js"); asset1.AddRawFileReference("~/image.png"); bundle.Assets.Add(asset1); bundle.Assets.Add(asset2); bundles.Add(bundle); fileSearch = new Mock <IFileSearch>(); fileSearch .Setup(s => s.IsMatch(It.IsAny <string>())) .Returns <string>(path => path.EndsWith(".js")); var initializer = new BundleCollectionInitializer(new[] { bundleConfiguration.Object }, new ExternalBundleGenerator(Mock.Of <IBundleFactoryProvider>(), settings)); rebuilder = new FileSystemWatchingBundleRebuilder(settings, bundles, initializer, new[] { fileSearch.Object }); }
protected override Bundle CreateBundleCore(CassetteSettings settings) { return(new TestableBundle(Path) { Hash = Hash }); }
protected ReferenceBuilder_Reference_TestBase() { settings = new CassetteSettings(); bundles = new BundleCollection(settings, Mock.Of <IFileSearchProvider>(), Mock.Of <IBundleFactoryProvider>(), Mock.Of <IBundleCollectionInitializer>()); bundleFactoryProvider = new Mock <IBundleFactoryProvider>(); placeholderTracker = new Mock <IPlaceholderTracker>(); builder = new ReferenceBuilder(bundles, placeholderTracker.Object, bundleFactoryProvider.Object, settings); }
public CacheAwareBundleCollectionInitializer(IEnumerable <IConfiguration <BundleCollection> > bundleConfigurations, IBundleCollectionCache cache, ExternalBundleGenerator externalBundleGenerator, ManifestValidator manifestValidator, CassetteSettings settings) { this.bundleConfigurations = bundleConfigurations; this.cache = cache; this.externalBundleGenerator = externalBundleGenerator; this.manifestValidator = manifestValidator; this.settings = settings; }
public CacheAwareBundleCollectionInitializer(IEnumerable<IConfiguration<BundleCollection>> bundleConfigurations, IBundleCollectionCache cache, ExternalBundleGenerator externalBundleGenerator, ManifestValidator manifestValidator, CassetteSettings settings) { this.bundleConfigurations = bundleConfigurations; this.cache = cache; this.externalBundleGenerator = externalBundleGenerator; this.manifestValidator = manifestValidator; this.settings = settings; }
internal void Process(CassetteSettings settings) { if (IsProcessed) { throw new InvalidOperationException("Bundle has already been processed."); } ProcessCore(settings); IsProcessed = true; }
public void ConstructorAppliesConfigurationsInOrderDefinedbyAttribute() { var configA = new ConfigA(); var configB = new ConfigB(); var settings = new CassetteSettings(new IConfiguration <CassetteSettings>[] { configB, configA }); // Each config appends a letter to Version so we can test the order that they were called. settings.Version.ShouldEqual("AB"); }
public void ConstructorAppliesConfigurations() { var configA = new ConfigA(); var configB = new ConfigB(); var settings = new CassetteSettings(new IConfiguration <CassetteSettings>[] { configA, configB }); configA.AssertWasCalled(settings); configB.AssertWasCalled(settings); }
Mock <ICassetteApplication> CreateApplication() { var app = new Mock <ICassetteApplication>(); var settings = new CassetteSettings { SourceDirectory = Mock.Of <IDirectory>() }; app.SetupGet(a => a.Settings).Returns(settings); return(app); }
public FileSystemWatchingBundleRebuilder(CassetteSettings settings, BundleCollection bundles, IBundleCollectionInitializer initializer, IEnumerable <IFileSearch> fileSearches) { this.settings = settings; this.bundles = bundles; this.initializer = initializer; this.fileSearches = fileSearches; bundleDescriptorFilenames = GetBundleDescriptorFilenames(); // Initially use the bundles collection, but this will get updated in the Changed event handler. readOnlyBundles = new ReadOnlyCollection <Bundle>(bundles.ToList()); bundles.Changed += HandleBundlesChanged; }
public FileSystemWatchingBundleRebuilder(CassetteSettings settings, BundleCollection bundles, IBundleCollectionInitializer initializer, IEnumerable<IFileSearch> fileSearches) { this.settings = settings; this.bundles = bundles; this.initializer = initializer; this.fileSearches = fileSearches; bundleDescriptorFilenames = GetBundleDescriptorFilenames(); // Initially use the bundles collection, but this will get updated in the Changed event handler. readOnlyBundles = new ReadOnlyCollection<Bundle>(bundles.ToList()); bundles.Changed += HandleBundlesChanged; }
T CreateApplication() { lock (creationLock) { var cacheVersion = GetConfigurationVersion(); var settings = new CassetteSettings(cacheVersion); var bundleContainerFactory = settings.GetBundleContainerFactory(CassetteConfigurations); var bundleContainer = bundleContainerFactory.CreateBundleContainer(); Trace.Source.TraceInformation("IsDebuggingEnabled: {0}", settings.IsDebuggingEnabled); Trace.Source.TraceInformation("Cache version: {0}", cacheVersion); Trace.Source.TraceInformation("Creating Cassette application object"); return(CreateCassetteApplicationCore(bundleContainer, settings)); } }
static IBundleContainer CreateBundleContainer(IEnumerable <Bundle> bundles, CassetteSettings settings, string cacheVersion) { IBundleContainerFactory containerFactory; if (settings.IsDebuggingEnabled) { containerFactory = new BundleContainerFactory(settings.BundleFactories); } else { containerFactory = new CachedBundleContainerFactory( new BundleCache( cacheVersion, settings ), settings.BundleFactories ); } return(containerFactory.Create(bundles, settings)); }
protected CassetteApplicationBase(IBundleContainer bundleContainer, CassetteSettings settings) { this.settings = settings; this.bundleContainer = bundleContainer; }
public ReferenceBuilder(IBundleContainer bundleContainer, IDictionary <Type, IBundleFactory <Bundle> > bundleFactories, IPlaceholderTracker placeholderTracker, CassetteSettings settings) { this.bundleContainer = bundleContainer; this.bundleFactories = bundleFactories; this.placeholderTracker = placeholderTracker; this.settings = settings; }
protected abstract void ProcessCore(CassetteSettings settings);
public FileContentHasher(CassetteSettings settings) { this.settings = settings; }
internal abstract void Process(CassetteSettings settings);
protected CassetteApplicationBase(IEnumerable <Bundle> bundles, CassetteSettings settings) { this.settings = settings; bundleContainer = CreateBundleContainer(bundles); }
public PageHelper(BundleCollection bundles, IUrlGenerator urlGenerator, CassetteSettings settings) { this.bundles = bundles; this.urlGenerator = urlGenerator; this.settings = settings; }
internal override void Process(CassetteSettings settings) { WasProcessed = true; }
protected abstract T CreateCassetteApplicationCore(IBundleContainer bundleContainer, CassetteSettings settings);
public override void Configure(CassetteSettings settings) { base.Configure(settings); settings.Version += "B"; }
public ExternalBundleGenerator(IBundleFactoryProvider bundleFactoryProvider, CassetteSettings settings) { this.bundleFactoryProvider = bundleFactoryProvider; this.settings = settings; }
protected override void ProcessCore(CassetteSettings settings) { WasProcessed = true; }
public ReferenceBuilder(BundleCollection allBundles, IPlaceholderTracker placeholderTracker, IBundleFactoryProvider bundleFactoryProvider, CassetteSettings settings) { this.allBundles = allBundles; this.placeholderTracker = placeholderTracker; this.bundleFactoryProvider = bundleFactoryProvider; this.settings = settings; }
protected CassetteApplicationBase(IEnumerable <Bundle> bundles, CassetteSettings settings, string cacheVersion) { this.settings = settings; bundleContainer = CreateBundleContainer(bundles, settings, cacheVersion); }