public AssetRequestHandler_Tests()
        {
            var routeData = new RouteData();
            request = new Mock<HttpRequestBase>();
            response = new Mock<HttpResponseBase>();
            cache = new Mock<HttpCachePolicyBase>();
            requestHeaders = new NameValueCollection();

            routeData.Values.Add("path", "test/asset_js");

            var httpContext = new Mock<HttpContextBase>();
            httpContext.SetupGet(r => r.Response)
                          .Returns(response.Object);
            httpContext.SetupGet(r => r.Request)
                          .Returns(request.Object);
            httpContext.SetupGet(r => r.Items)
                          .Returns(new Dictionary<string, object>());

            var requestContext = new RequestContext(httpContext.Object, routeData);
            request.SetupGet(x => x.RawUrl).Returns("~/test/010203/asset.js");

            response.SetupGet(r => r.OutputStream).Returns(() => outputStream);
            response.SetupGet(r => r.Cache).Returns(cache.Object);
            request.SetupGet(r => r.Headers).Returns(requestHeaders);

            bundles = new BundleCollection(new CassetteSettings(), Mock.Of<IFileSearchProvider>(), Mock.Of<IBundleFactoryProvider>());
            handler = new AssetRequestHandler(requestContext, bundles);
        }
Esempio n. 2
0
        public AssetRequestHandler_Tests()
        {
            var routeData = new RouteData();

            request        = new Mock <HttpRequestBase>();
            response       = new Mock <HttpResponseBase>();
            cache          = new Mock <HttpCachePolicyBase>();
            requestHeaders = new NameValueCollection();

            routeData.Values.Add("path", "test/asset_js");

            var httpContext = new Mock <HttpContextBase>();

            httpContext.SetupGet(r => r.Response)
            .Returns(response.Object);
            httpContext.SetupGet(r => r.Request)
            .Returns(request.Object);
            httpContext.SetupGet(r => r.Items)
            .Returns(new Dictionary <string, object>());

            var requestContext = new RequestContext(httpContext.Object, routeData);

            response.SetupGet(r => r.OutputStream).Returns(() => outputStream);
            response.SetupGet(r => r.Cache).Returns(cache.Object);
            request.SetupGet(r => r.Headers).Returns(requestHeaders);

            bundles = new BundleCollection(new CassetteSettings(), Mock.Of <IFileSearchProvider>(), Mock.Of <IBundleFactoryProvider>());
            handler = new AssetRequestHandler(requestContext, bundles);
        }