Esempio n. 1
0
        public void Css_ShouldAskCombinerForCombinationMatchingKey()
        {
            var combination = new IncludeCombination(IncludeType.Css, new[] { "foo.css" }, "#Foo{color:red;}", DateTime.UtcNow, new CssTypeElement());

            _mockSettings.Expect(s => s.Types[IncludeType.Css]).Return(new CssTypeElement());
            _mockCombiner.Expect(c => c.GetCombination("foo")).Return(combination);
            ActionResult result = _controller.Css("foo");

            Assert.IsInstanceOf <IncludeCombinationResult>(result);
            Assert.AreEqual(combination, ((IncludeCombinationResult)result).Combination);
            _mocks.VerifyAll();
        }
Esempio n. 2
0
        public void RenderIncludes_ShouldWriteOutASingleReferenceToTheCompressorController_WhenInReleaseMode(RenderingInRelease data)
        {
            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[data.Type]).Return(data.Settings);
            foreach (var kvp in data.Includes)
            {
                var include = new Include(data.Type, kvp.Key, "foo", DateTime.UtcNow);
                _mockReader.Expect(r => r.Read(kvp.Key, data.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}", data.Type.ToString().ToLowerInvariant(), data.Key));
            string hash = null;

            _mockStorage.Expect(s => hash = s.Store(Arg <IncludeCombination> .Is.NotNull)).Return("foo");

            string reference = _combiner.RenderIncludes(data.Includes.Keys, data.Type, false);

            Assert.AreEqual(data.Expected, reference);
        }