Exemple #1
0
        public async Task Run_QueryGraphQlIntrospection_ReturnsResults()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew("graphql", "Default");

                await project.DotnetRestore();

                await project.DotnetBuild();

                await project.DotnetRun(
                    @"Source\Default",
                    async (httpClient, httpsClient) =>
                {
                    var introspectionQuery = await httpClient.PostGraphQL(GraphQlQuery.Introspection);
                    Assert.Equal(HttpStatusCode.OK, introspectionQuery.StatusCode);
                    var introspectionContent = await introspectionQuery.Content.ReadAsAsync <GraphQLResponse>();
                    Assert.Null(introspectionContent.Errors);
                });
            }
        }
Exemple #2
0
        public async Task Run_Default_Successful()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew("api", "Default");

                await project.DotnetRestore();

                await project.DotnetBuild();

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

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

                    var statusSelfResponse = await httpsClient.GetAsync("status/self");
                    Assert.Equal(HttpStatusCode.OK, statusSelfResponse.StatusCode);

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

                    var swaggerJsonResponse = await httpsClient.GetAsync("swagger/v1/swagger.json");
                    Assert.Equal(HttpStatusCode.OK, swaggerJsonResponse.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);
                });
            }
        }
Exemple #3
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.DotnetRestore();

                await project.DotnetBuild();

                await project.DotnetRun(
                    async (httpClient) =>
                {
                    var httpResponse = await httpClient.GetAsync("/");
                    Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
                });
            }
        }
Exemple #4
0
        public async Task Run_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("/");
                    Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);

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

                    var liveResponse = await httpsClient.GetAsync("status/live");
                    Assert.Equal(HttpStatusCode.OK, liveResponse.StatusCode);

                    var readyResponse = await httpsClient.GetAsync("status/ready");
                    Assert.Equal(HttpStatusCode.OK, readyResponse.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);
                });
            }
        }
        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.DotnetRestore();

                await project.DotnetBuild();

                await project.DotnetRun(
                    async (httpClient, httpsClient) =>
                {
                    var swaggerJsonResponse = await httpsClient.GetAsync("swagger/v1/swagger.json");
                    Assert.Equal(HttpStatusCode.NotFound, swaggerJsonResponse.StatusCode);
                });
            }
        }