public void SetUp()
 {
     _path = Path.GetTempFileName();
     File.WriteAllText(_path, ".css { text-align: right; }");
     _bundle = new Bundle().File("file1");
     _fileSystem = MockRepository.GenerateMock<IFileSystem>();
     _fileSystem.Stub(arg => arg.AbsolutePath("file1")).Return(_path);
     _fileSystem
         .Stub(arg => arg.OpenFile(_path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
         .WhenCalled(arg => arg.ReturnValue = File.OpenRead(_path))
         .Return(null);
     _concatenator = MockRepository.GenerateMock<IAssetConcatenator>();
     _concatenator
         .Stub(arg => arg.Concatenate(Arg<IEnumerable<string>>.Is.Anything))
         .WhenCalled(arg => arg.ReturnValue = ((IEnumerable<string>)arg.Arguments.First()).First())
         .Return(null);
     _transformer = MockRepository.GenerateMock<IAssetTransformer>();
     _transformer
         .Stub(arg => arg.Transform(Arg<string>.Is.Anything))
         .WhenCalled(arg => arg.ReturnValue = arg.Arguments.First())
         .Return(null);
     _watcher = new BundleWatcher(_bundle, _fileSystem, _concatenator, _transformer);
     _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>();
     _systemClock = MockRepository.GenerateMock<ISystemClock>();
     _systemClock.Stub(arg => arg.UtcDateTime).Return(new DateTime(2012, 1, 1, 0, 0, 0, DateTimeKind.Utc));
     _routeId = Guid.NewGuid();
     _cssBundleWatcherRoute = new CssBundleWatcherRoute("route", _routeId, "relative", _watcher, _httpRuntime, _systemClock);
 }
Ejemplo n.º 2
0
        public static void CompressBundle(Bundle bundle, IAssetTransformer minifier, CassetteSettings settings)
        {
            new AssignHash().Process(bundle, settings);

            if (!settings.IsDebuggingEnabled)
            {
                bundle.ConcatenateAssets();
                new MinifyAssets(minifier).Process(bundle, settings);
            }
        }
Ejemplo n.º 3
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
     _asset.AddAssetTransformer(transformer);
 }
Ejemplo n.º 4
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
     // No transformations applied. Asset served as-is.
 }
Ejemplo n.º 5
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
     transformers.Add(transformer);
 }
Ejemplo n.º 6
0
 public MinifyAssets(IAssetTransformer minifier)
 {
     this.minifier = minifier;
 }
Ejemplo n.º 7
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
     transformers.Add(transformer);
 }
Ejemplo n.º 8
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
 }
Ejemplo n.º 9
0
 protected AddTransformerToAssets(IAssetTransformer assetTransformer)
 {
     this.assetTransformer = assetTransformer;
 }
Ejemplo n.º 10
0
 public void SetUp()
 {
     _bundle = new Bundle()
         .Directory("directory1")
         .File("file1");
     _fileSystem = MockRepository.GenerateMock<IFileSystem>();
     _fileSystem.Stub(arg => arg.AbsolutePath("directory1")).Return("directory1");
     _fileSystem.Stub(arg => arg.AbsolutePath("file1")).Return("file1");
     _fileSystem.Stub(arg => arg.AbsolutePath("file2")).Return("file2");
     _fileSystem.Stub(arg => arg.AbsolutePath("file3")).Return("file3");
     _fileSystem.Stub(arg => arg.GetDirectoryFiles("directory1", "*.*", SearchOption.AllDirectories)).Return(new[] { "file2", "file3" });
     _fileSystem
         .Stub(arg => arg.OpenFile(Arg<string>.Is.Anything, Arg<FileMode>.Is.Equal(FileMode.Open), Arg<FileAccess>.Is.Equal(FileAccess.Read), Arg<FileShare>.Is.Equal(FileShare.ReadWrite)))
         .WhenCalled(arg => arg.ReturnValue = new MemoryStream(Encoding.ASCII.GetBytes("ABC")))
         .Return(null);
     _comparer = MockRepository.GenerateMock<IComparer<AssetFile>>();
     _concatenator = MockRepository.GenerateMock<IAssetConcatenator>();
     _concatenator.Stub(arg => arg.Concatenate(Arg<IEnumerable<string>>.Is.Anything)).Return("");
     _transformer = MockRepository.GenerateMock<IAssetTransformer>();
     _transformer.Stub(arg => arg.Transform(Arg<string>.Is.Anything)).Return("");
     _bundle.GetContents(_fileSystem, _comparer, _concatenator, _transformer);
 }
Ejemplo n.º 11
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 12
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
     // No transformations applied. Asset served as-is.
 }
Ejemplo n.º 13
0
 public void SetUp()
 {
     _path = Path.GetTempFileName();
     File.WriteAllText(_path, "contents");
     _bundle = new Bundle().File("file1");
     _fileSystem = MockRepository.GenerateMock<IFileSystem>();
     _fileSystem.Stub(arg => arg.AbsolutePath("file1")).Return(_path);
     _fileSystem
         .Stub(arg => arg.OpenFile(_path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
         .WhenCalled(arg => arg.ReturnValue = File.OpenRead(_path))
         .Return(null);
     _concatenator = MockRepository.GenerateMock<IAssetConcatenator>();
     _concatenator
         .Stub(arg => arg.Concatenate(Arg<IEnumerable<string>>.Is.Anything))
         .WhenCalled(arg => arg.ReturnValue = ((IEnumerable<string>)arg.Arguments.First()).First())
         .Return(null);
     _transformer = MockRepository.GenerateMock<IAssetTransformer>();
     _transformer
         .Stub(arg => arg.Transform(Arg<string>.Is.Anything))
         .WhenCalled(arg => arg.ReturnValue = arg.Arguments.First())
         .Return(null);
     _watcher = new BundleWatcher(_bundle, _fileSystem, _concatenator, _transformer);
 }
Ejemplo n.º 14
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 15
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 16
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
 }
Ejemplo n.º 17
0
 public void AddAssetTransformer(IAssetTransformer transformer)
 {
     throw new NotSupportedException();
 }