예제 #1
0
        public void RenderIncludes_ShouldWriteOutEachIncludeSeparately_WhenInDebugMode(RenderingInDebug data)
        {
            var stubContext = _mocks.Stub <HttpContextBase>();

            stubContext.Replay();
            stubContext.Expect(c => c.IsDebuggingEnabled).Return(true);
            _mockHttp.Expect(s => s.Context).Return(stubContext);
            foreach (var kvp in data.Includes)
            {
                _mockReader.Expect(sr => sr.ToAbsolute(kvp.Key)).Return(kvp.Value);
            }
            _mockStorage.Expect(s => s.Clear());
            string rendered = _combiner.RenderIncludes(data.Includes.Keys, data.Type, true);

            Assert.AreEqual(rendered, data.Expected);
        }
        public void RegisterInclude_ShouldAskStorageToStoreIt()
        {
            var include = new Include(IncludeType.Js, "foo.js", "alert('');", DateTime.UtcNow);

            _mockReader.Expect(r => r.Read("~/foo.js", include.Type)).Return(include);
            _mockStorage.Expect(s => s.Store(include));
            _combiner.RegisterInclude("~/foo.js", IncludeType.Js);
            _mocks.VerifyAll();
        }