Esempio n. 1
0
        public AssetRequestHandler_Tests()
        {
            var requestContext = new Mock <RequestContext>();
            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");
            requestContext.SetupGet(r => r.RouteData)
            .Returns(routeData);

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

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

            var bundleContainer = new Mock <IBundleContainer>();

            bundleContainer.Setup(c => c.FindBundleContainingPath <Bundle>(It.IsAny <string>()))
            .Returns(() => bundle);
            handler = new AssetRequestHandler(requestContext.Object, () => bundleContainer.Object);
        }
Esempio n. 2
0
        public AssetRequestHandler_Tests()
        {
            var requestContext = new Mock<RequestContext>();
            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");
            requestContext.SetupGet(r => r.RouteData)
                          .Returns(routeData);

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

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

            var bundleContainer = new Mock<IBundleContainer>();
            bundleContainer.Setup(c => c.FindBundleContainingPath<Bundle>(It.IsAny<string>()))
                           .Returns(() => bundle);
            handler = new AssetRequestHandler(requestContext.Object, () => bundleContainer.Object);
        }
Esempio n. 3
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 List <Bundle>();
            handler = new AssetRequestHandler(requestContext, bundles);
        }
Esempio n. 4
0
        public AssetRequestHandler_Tests()
        {
            var routeData = new RouteData();
            request = new Mock<HttpRequestBase>();
            response = new Mock<HttpResponseBase>();
            cache = new Mock<HttpCachePolicyBase>();
            requestHeaders = new NameValueCollection();
            interation = new Mock<IInteractWithDependencyGraph>();

            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 List<Bundle>();

            handler = new AssetRequestHandler(requestContext, interation.Object);
        }
Esempio n. 5
0
        public AssetRequestHandler_Tests()
        {
            var requestContext = new Mock<RequestContext>();
            var routeData = new RouteData();
            response = new Mock<HttpResponseBase>();

            routeData.Values.Add("path", "test/asset.js");
            requestContext.SetupGet(r => r.RouteData)
                          .Returns(routeData);

            requestContext.SetupGet(r => r.HttpContext.Response)
                          .Returns(response.Object);

            response.SetupGet(r => r.OutputStream).Returns(() => outputStream);

            handler = new AssetRequestHandler(requestContext.Object, _ => module);
        }