示例#1
0
        public void WhenCombinationExists_ShouldCorrectlySetUpResponse()
        {
            _mockHttpContext.Expect(hc => hc.Response).Return(_mockResponse);
            _mockHttpContext.Expect(hc => hc.Request).Return(_mockRequest);
            _mockRequest.Expect(r => r.Headers[HttpHeaders.AcceptEncoding]).Return("");
            _mockResponse.Expect(r => r.ContentEncoding = Encoding.UTF8);
            _mockResponse.Expect(r => r.ContentType     = MimeTypes.TextCss);
            _mockResponse.Expect(r => r.AddHeader(HttpHeaders.ContentLength, "16"));
            _mockResponse.Expect(r => r.OutputStream).Return(new MemoryStream(8092)).Repeat.Twice();
            _mockResponse.Expect(r => r.Cache).Return(_mockCachePolicy);
            _mockCachePolicy.Expect(cp => cp.SetETag(Arg <string> .Matches(etag => etag.StartsWith("foo") && etag.EndsWith(_cssCombination.LastModifiedAt.Ticks.ToString()))));
            _stubCombiner.Expect(c => c.GetCombination("foo")).Return(_cssCombination);

            var result = new IncludeCombinationResult(_stubCombiner, "foo", DateTime.UtcNow);

            result.ExecuteResult(_controllerContext);

            _mocks.VerifyAll();
        }