feat(MockAPI): Hinzufügen einer API zum Testen von Proxy-Servern.

- Swagger optional gemacht.
This commit is contained in:
Developer 02 2025-01-29 18:17:45 +01:00
parent 836b19df9e
commit 054527b4ba
7 changed files with 115 additions and 0 deletions

View File

@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.Swagger.Proxy",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C5ED9B8C-5A36-440E-BF25-8FB0EC870924}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.Swagger.MockAPI", "src\DigitalData.Swagger.MockAPI\DigitalData.Swagger.MockAPI.csproj", "{1D229E96-67BC-4717-B6E6-60A067BC498E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -17,12 +19,17 @@ Global
{2CC25C4F-147E-4A64-9EA9-51C00BC7430E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2CC25C4F-147E-4A64-9EA9-51C00BC7430E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2CC25C4F-147E-4A64-9EA9-51C00BC7430E}.Release|Any CPU.Build.0 = Release|Any CPU
{1D229E96-67BC-4717-B6E6-60A067BC498E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D229E96-67BC-4717-B6E6-60A067BC498E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D229E96-67BC-4717-B6E6-60A067BC498E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D229E96-67BC-4717-B6E6-60A067BC498E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2CC25C4F-147E-4A64-9EA9-51C00BC7430E} = {C5ED9B8C-5A36-440E-BF25-8FB0EC870924}
{1D229E96-67BC-4717-B6E6-60A067BC498E} = {C5ED9B8C-5A36-440E-BF25-8FB0EC870924}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {071BB599-BE8A-4680-A008-35B0357D4899}

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,6 @@
@DigitalData.Swagger.MockAPI_HostAddress = http://localhost:5055
GET {{DigitalData.Swagger.MockAPI_HostAddress}}/weatherforecast/
Accept: application/json
###

View File

@ -0,0 +1,26 @@
var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration;
// Add services to the container.
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (config.GetValue<bool>("UseSwagger"))
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@ -0,0 +1,41 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53791",
"sslPort": 44384
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5055",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7248;http://localhost:5055",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"UseSwagger": true
}