Пример #1
0
        public async Task get_raw_index_html_with_document_title()
        {
            var indexHtmlLoader = new IndexHtmlLoader();

            var rawIndexHtml = await indexHtmlLoader.LoadRawWith(ADocumentTitle, ARootUrl, AUrlPath);

            rawIndexHtml.Contains($"<title>{ADocumentTitle}</title>").Should().BeTrue();
        }
Пример #2
0
        private async Task RespondWithIndexHtml(HttpResponse response, string rootUrl)
        {
            response.StatusCode  = 200;
            response.ContentType = "text/html;charset=utf-8";
            var rawIndexHtml = await idexHtmlLoader.LoadRawWith(configuration.IndexHtmlDocumentTitle, rootUrl, configuration.UrlPath);

            await response.WriteAsync(rawIndexHtml, Encoding.UTF8);
        }
Пример #3
0
        public async Task render_index_html()
        {
            configuration.UrlPath = AUrlPath;
            configuration.IndexHtmlDocumentTitle = AIndexHtmlDocumentTitle;
            httpContext.Request.Method           = HttpMethods.Get;
            httpContext.Request.Path             = new PathString($"/{AUrlPath}/index.html");
            httpContext.Request.Scheme           = "https";
            httpContext.Request.Host             = new HostString("localhost", 44349);
            indexHtmlLoader.LoadRawWith(AIndexHtmlDocumentTitle, "https://localhost:44349", AUrlPath).Returns(ARawIndexHtml);

            await middleware.Invoke(httpContext);

            httpContext.Response.StatusCode  = (int)HttpStatusCode.OK;
            httpContext.Response.ContentType = "text/html;charset=utf-8";
            var responseBody = await ReadResponseBodyFrom(httpContext.Response.Body);

            responseBody.Should().Be(ARawIndexHtml);
        }