diff --git a/Api/Api.sln b/Api/Api.sln index 5339c98..7d308b3 100644 --- a/Api/Api.sln +++ b/Api/Api.sln @@ -1,10 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.14.36301.6 d17.14 +VisualStudioVersion = 17.14.36301.6 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Api", "Api.csproj", "{EC86C676-06E8-4011-A4E3-5118543F4728}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "..\Tests\Tests.csproj", "{819F3EDC-F488-4C63-89D0-4BE09CD0C485}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {EC86C676-06E8-4011-A4E3-5118543F4728}.Debug|Any CPU.Build.0 = Debug|Any CPU {EC86C676-06E8-4011-A4E3-5118543F4728}.Release|Any CPU.ActiveCfg = Release|Any CPU {EC86C676-06E8-4011-A4E3-5118543F4728}.Release|Any CPU.Build.0 = Release|Any CPU + {819F3EDC-F488-4C63-89D0-4BE09CD0C485}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {819F3EDC-F488-4C63-89D0-4BE09CD0C485}.Debug|Any CPU.Build.0 = Debug|Any CPU + {819F3EDC-F488-4C63-89D0-4BE09CD0C485}.Release|Any CPU.ActiveCfg = Release|Any CPU + {819F3EDC-F488-4C63-89D0-4BE09CD0C485}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tests/.gitignore b/Tests/.gitignore new file mode 100644 index 0000000..d86ba9f --- /dev/null +++ b/Tests/.gitignore @@ -0,0 +1,2 @@ +obj/ +bin/ \ No newline at end of file diff --git a/Tests/IntegrationTest1.cs b/Tests/IntegrationTest1.cs new file mode 100644 index 0000000..77f39f8 --- /dev/null +++ b/Tests/IntegrationTest1.cs @@ -0,0 +1,38 @@ +namespace Tests.Tests +{ + public class IntegrationTest1 + { + // Instructions: + // 1. Add a project reference to the target AppHost project, e.g.: + // + // + // + // + // + // 2. Uncomment the following example test and update 'Projects.MyAspireApp_AppHost' to match your AppHost project: + // + // [Fact] + // public async Task GetWebResourceRootReturnsOkStatusCode() + // { + // // Arrange + // var appHost = await DistributedApplicationTestingBuilder.CreateAsync(); + // appHost.Services.ConfigureHttpClientDefaults(clientBuilder => + // { + // clientBuilder.AddStandardResilienceHandler(); + // }); + // // To output logs to the xUnit.net ITestOutputHelper, consider adding a package from https://www.nuget.org/packages?q=xunit+logging + // + // await using var app = await appHost.BuildAsync(); + // var resourceNotificationService = app.Services.GetRequiredService(); + // await app.StartAsync(); + + // // Act + // var httpClient = app.CreateHttpClient("webfrontend"); + // await resourceNotificationService.WaitForResourceAsync("webfrontend", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30)); + // var response = await httpClient.GetAsync("/"); + + // // Assert + // Assert.Equal(HttpStatusCode.OK, response.StatusCode); + // } + } +} diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj new file mode 100644 index 0000000..dfef693 --- /dev/null +++ b/Tests/Tests.csproj @@ -0,0 +1,27 @@ + + + + net8.0 + enable + enable + false + true + + + + + + + + + + + + + + + + + + +