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); }
public CssBundleWatcherRoute(string name, Guid id, string relativePath, BundleWatcher watcher, IHttpRuntime httpRuntime, ISystemClock systemClock) : base(name, id, relativePath, watcher, httpRuntime) { systemClock.ThrowIfNull("systemClock"); _systemClock = systemClock; }
protected BundleWatcherRoute(string name, Guid id, string relativePath, BundleWatcher watcher, IHttpRuntime httpRuntime) : base(name, id) { relativePath.ThrowIfNull("relativePath"); watcher.ThrowIfNull("watcher"); httpRuntime.ThrowIfNull("httpRuntime"); _relativePath = relativePath; _watcher = watcher; _httpRuntime = httpRuntime; _watcher.BundleChanged += WatcherBundleChanged; ConfigureRoute(); }
public JavaScriptBundleWatcherRoute(string name, IGuidFactory guidFactory, string relativePath, BundleWatcher watcher, IHttpRuntime httpRuntime, ISystemClock systemClock) : base(name, guidFactory, relativePath, watcher, httpRuntime) { systemClock.ThrowIfNull("systemClock"); _systemClock = systemClock; }
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); }