public void RegisterInclude_ShouldAskStorageToStoreIt()
 {
     var include = new Include(IncludeType.Js, "foo.js", "alert('');", Clock.UtcNow);
     _mockReader.Expect(r => r.Read("~/foo.js", include.Type)).Return(include);
     _mockStorage.Expect(s => s.Store(include));
     Assert.DoesNotThrow(() => _combiner.RegisterInclude("~/foo.js", IncludeType.Js));
     _mocks.VerifyAll();
 }
        public void RenderIncludes_ShouldWriteOutASingleReferenceToTheCompressorController_WhenInReleaseMode(IDictionary<string, string> includes, IncludeType type, string key, string expected, IncludeTypeElement settings)
        {
            var stubContext = _mocks.Stub<HttpContextBase>();
            stubContext.Replay();
            stubContext.Expect(c => c.IsDebuggingEnabled).Return(false);
            _mockHttp.Expect(s => s.Context).Return(stubContext);
            _mockSettings.Expect(s => s.Types[type]).Return(settings);
            foreach (var kvp in includes)
            {
                var include = new Include(type, kvp.Key, "foo", Clock.UtcNow);
                _mockReader.Expect(r => r.Read(kvp.Key, type)).Return(include);
                _mockStorage.Expect(s => s.Store(include));
            }
            _mockReader.Expect(r => r.ToAbsolute(Arg<string>.Is.NotNull)).Return(string.Format("/content/{0}/{1}.{0}", type.ToString().ToLowerInvariant(), key));
            string hash = null;
            _mockStorage.Expect(s => hash = s.Store(Arg<IncludeCombination>.Is.NotNull)).Return("foo");

            string reference = null;
            Assert.DoesNotThrow(() => reference = _combiner.RenderIncludes(includes.Keys, type, false));
            Assert.Equal(expected, reference);
        }
 public void StoreIncludeTwice_DoesNotThrow()
 {
     var include = new Include(IncludeType.Js, "/foo.js", "alert('foo');", Clock.UtcNow);
     Assert.DoesNotThrow(() => _storage.Store(include));
     Assert.DoesNotThrow(() => _storage.Store(include));
 }