public async Task Build_HttpsEverywhereFalse_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew(
                    "graphql",
                    "HttpsEverywhereFalse",
                    new Dictionary <string, string>()
                {
                    { "https-everywhere", "false" },
                });

                await project.DotnetRestore();

                await project.DotnetBuild();

                await project.DotnetRun(
                    async (httpClient, httpsClient) =>
                {
                    var httpResponse = await httpClient.GetAsync("/");
                    httpResponse.EnsureSuccessStatusCode();
                    var httpsResponse = await httpsClient.GetAsync("/");
                    httpsResponse.EnsureSuccessStatusCode();
                });
            }
        }
示例#2
0
        public async Task Build_HttpsEverywhereFalse_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew(
                    "api",
                    "HttpsEverywhereFalse",
                    new Dictionary <string, string>()
                {
                    { "https-everywhere", "false" },
                });

                await project.DotnetRestore();

                await project.DotnetBuild();

                await project.DotnetRun(
                    async() =>
                {
                    var httpResponse = await this.HttpClient.GetAsync("http://localhost:5000/status");
                    httpResponse.EnsureSuccessStatusCode();
                    var httpsResponse = await this.HttpClient.GetAsync("https://localhost:5001/status");
                    httpsResponse.EnsureSuccessStatusCode();
                });
            }
        }
示例#3
0
        public async Task Build_HttpsEverywhereFalse_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew(
                    "api",
                    "HttpsEverywhereFalse",
                    new Dictionary <string, string>()
                {
                    { "HttpsEverywhere", "false" },
                });

                await project.DotnetRestore();

                await project.DotnetBuild();

                // await project.DotnetRun(
                //     async () =>
                //     {
                //         var response = await this.HttpClient.GetAsync("http://localhost:5000/status");
                //         response.EnsureSuccessStatusCode();
                //         await Assert.ThrowsAsync<HttpRequestException>(
                //             () => this.HttpClient.GetAsync("https://localhost:44300/status"));
                //     });
            }
        }
示例#4
0
        public async Task Run_Default_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew("graphql", "Default");

                await project.DotnetRun(
                    async (httpClient, httpsClient) =>
                {
                    var httpResponse = await httpClient.GetAsync("/");
                    Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);

                    var httpsResponse = await httpsClient.GetAsync("/");
                    Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);

                    var robotsTxtResponse = await httpsClient.GetAsync("robots.txt");
                    Assert.Equal(HttpStatusCode.OK, robotsTxtResponse.StatusCode);

                    var securityTxtResponse = await httpsClient.GetAsync(".well-known/security.txt");
                    Assert.Equal(HttpStatusCode.OK, securityTxtResponse.StatusCode);

                    var humansTxtResponse = await httpsClient.GetAsync("humans.txt");
                    Assert.Equal(HttpStatusCode.OK, humansTxtResponse.StatusCode);
                });
            }
        }
示例#5
0
        public async Task RestoreAndBuild_Default_Successful(string name, params string[] arguments)
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var dictionary = arguments
                                 .Select(x => x.Split('=', StringSplitOptions.RemoveEmptyEntries))
                                 .ToDictionary(x => x.First(), x => x.Last());
                var project = await tempDirectory.DotnetNew("graphql", name, dictionary);

                await project.DotnetRestore();

                await project.DotnetBuild();
            }
        }
        public async Task Run_Default_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew("graphql", "Default");

                await project.DotnetRun(
                    async (httpClient, httpsClient) =>
                {
                    var httpResponse = await httpClient.GetAsync("/");
                    Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);

                    var httpsResponse = await httpsClient.GetAsync("/");
                    Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
                });
            }
        }
        public async Task Build_Default_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew("graphql", "Default");

                await project.DotnetRestore();

                await project.DotnetBuild();

                await project.DotnetRun(
                    async (httpClient, httpsClient) =>
                {
                    var httpResponse = await httpClient.GetAsync("/");
                    httpResponse.EnsureSuccessStatusCode();
                    var httpsResponse = await httpsClient.GetAsync("/");
                    httpsResponse.EnsureSuccessStatusCode();
                });
            }
        }
示例#8
0
        public async Task Build_Default_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew("api", "Default");

                await project.DotnetRestore();

                await project.DotnetBuild();

                await project.DotnetRun(
                    async() =>
                {
                    var httpResponse = await this.HttpClient.GetAsync("http://localhost:5000/status");
                    httpResponse.EnsureSuccessStatusCode();
                    var httpsResponse = await this.HttpClient.GetAsync("https://localhost:5001/status");
                    httpsResponse.EnsureSuccessStatusCode();
                });
            }
        }
示例#9
0
        public async Task Run_HttpsEverywhereFalse_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew(
                    "graphql",
                    "HttpsEverywhereFalse",
                    new Dictionary <string, string>()
                {
                    { "https-everywhere", "false" },
                });

                await project.DotnetRun(
                    async (httpClient) =>
                {
                    var httpResponse = await httpClient.GetAsync("/");
                    Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
                });
            }
        }
示例#10
0
        public async Task Run_SwaggerFalse_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew(
                    "api",
                    "SwaggerFalse",
                    new Dictionary <string, string>()
                {
                    { "swagger", "false" },
                });

                await project.DotnetRun(
                    async (httpClient, httpsClient) =>
                {
                    var swaggerJsonResponse = await httpsClient.GetAsync("swagger/v1/swagger.json");
                    Assert.Equal(HttpStatusCode.NotFound, swaggerJsonResponse.StatusCode);
                });
            }
        }
示例#11
0
        public async Task Run_Default_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew("api", "Default");

                await project.DotnetRun(
                    async (httpClient, httpsClient) =>
                {
                    var httpResponse = await httpClient.GetAsync("status");
                    Assert.Equal(HttpStatusCode.NoContent, httpResponse.StatusCode);

                    var httpsResponse = await httpsClient.GetAsync("status");
                    Assert.Equal(HttpStatusCode.NoContent, httpsResponse.StatusCode);

                    var swaggerJsonResponse = await httpsClient.GetAsync("swagger/v1/swagger.json");
                    Assert.Equal(HttpStatusCode.OK, swaggerJsonResponse.StatusCode);
                });
            }
        }
示例#12
0
        public async Task Build_Default_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew("graphql", "Default");

                await project.DotnetRestore();

                await project.DotnetBuild();

                // await project.DotnetRun(
                //     async () =>
                //     {
                //         await Assert.ThrowsAsync<HttpRequestException>(
                //             () => this.HttpClient.GetAsync("http://localhost:5000/status"));
                //         var response = await this.HttpClient.GetAsync("https://localhost:44300/status");
                //         response.EnsureSuccessStatusCode();
                //     });
            }
        }