Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefH committed Sep 11, 2024
1 parent 94fed7b commit 41275f6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
22 changes: 18 additions & 4 deletions examples/WireMock.Net.WebApplication/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();

if (!builder.Environment.IsProduction())
{
builder.Services.AddWireMockService(server =>
Expand All @@ -21,6 +19,22 @@

var app = builder.Build();

app.MapControllers();
app.MapGet("/weatherforecast", () =>
{
var forecast = Enumerable.Range(1, 5).Select(index =>
new WeatherForecast
(
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
Random.Shared.Next(-20, 55),
"..."
))
.ToArray();
return forecast;
});

app.Run();

await app.RunAsync();
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
{
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "test",
"launchUrl": "weatherforecast",
"applicationUrl": "http://localhost:5112",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
Expand All @@ -23,7 +23,7 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "test",
"launchUrl": "weatherforecast",
"applicationUrl": "https://localhost:7021;http://localhost:5112",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
Expand All @@ -32,7 +32,7 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "test",
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down

0 comments on commit 41275f6

Please sign in to comment.