Beispiel #1
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"));
                //     });
            }
        }
Beispiel #2
0
        public ApiTemplateTest()
        {
            TemplateAssert.TempDirectoryPath = ConfigurationService.GetTempDirectoryPath();

            var projectDirectoryPath = TemplateAssert.GetProjectDirectoryPath(
                typeof(ApiTemplateTest).GetTypeInfo().Assembly,
                ProjectFileName);

            TemplateAssert.DotnetNewInstall(projectDirectoryPath).Wait();
        }
Beispiel #3
0
        public async Task Home_BuildsAndRuns_Returns200Ok()
        {
            using (var project = await TemplateAssert.DotnetNew("bapi", "HomeTest"))
            {
                await TemplateAssert.DotnetRestore(project.DirectoryPath);

                await TemplateAssert.DotnetBuild(project.DirectoryPath);

                await TemplateAssert.DotnetPublish(project.DirectoryPath, "netcoreapp1.1");

                await TemplateAssert.DotnetRun(
                    project.DirectoryPath,
                    async testServer =>
                {
                    var response = await testServer.CreateClient().GetAsync("/");
                    Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                });
            }
        }
Beispiel #4
0
        public async Task Home_BuildsAndRuns_Returns200Ok()
        {
            using (var tempDirectory = TemplateAssert.GetTempDirectory())
            {
                var project = await tempDirectory.DotnetNew("api", "HomeTest");

                await project.DotnetRestore();

                await project.DotnetBuild();

                await project.DotnetPublish("netcoreapp2.0");

                // await project.DotnetRun(
                //     async testServer =>
                //     {
                //         var response = await testServer.CreateClient().GetAsync("/");
                //         Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                //     });
            }
        }
Beispiel #5
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 () =>
                //     {
                //         await Assert.ThrowsAsync<HttpRequestException>(
                //             () => this.HttpClient.GetAsync("http://localhost:5000/status"));
                //         var response = await this.HttpClient.GetAsync("https://localhost:44300/status");
                //         response.EnsureSuccessStatusCode();
                //     });
            }
        }