mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-19 00:27:04 +01:00
* WireMock.Net.Testcontainers: implement watching the static mapping files + folder for changes * ReloadStaticMappings * fix * . * . * . * . * . * . * . * CopyAsync * <VersionPrefix>1.6.7-preview-02</VersionPrefix> * <VersionPrefix>1.6.7-preview-03</VersionPrefix>
50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using AspireApp1.AppHost;
|
|
|
|
var builder = DistributedApplication.CreateBuilder(args);
|
|
|
|
// IResourceBuilder<ProjectResource> apiService = builder.AddProject<Projects.AspireApp1_ApiService>("apiservice");
|
|
|
|
var mappingsPath = Path.Combine(Directory.GetCurrentDirectory(), "WireMockMappings");
|
|
|
|
IResourceBuilder<WireMockServerResource> apiService = builder
|
|
.AddWireMock("apiservice", WireMockServerArguments.DefaultPort)
|
|
.WithMappingsPath(mappingsPath)
|
|
.WithReadStaticMappings()
|
|
.WithWatchStaticMappings()
|
|
.WithApiMappingBuilder(WeatherForecastApiMock.BuildAsync);
|
|
|
|
//var apiServiceUsedForDocs = builder
|
|
// .AddWireMock("apiservice1", WireMockServerArguments.DefaultPort)
|
|
// .WithApiMappingBuilder(adminApiBuilder =>
|
|
// {
|
|
// var summaries = new[]
|
|
// {
|
|
// "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
|
// };
|
|
|
|
// adminApiBuilder.Given(b => b
|
|
// .WithRequest(request => request
|
|
// .UsingGet()
|
|
// .WithPath("/weatherforecast2")
|
|
// )
|
|
// .WithResponse(response => response
|
|
// .WithHeaders(h => h.Add("Content-Type", "application/json"))
|
|
// .WithBodyAsJson(() => Enumerable.Range(1, 5).Select(index =>
|
|
// new WeatherForecast
|
|
// (
|
|
// DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
|
// Random.Shared.Next(-20, 55),
|
|
// "WireMock.Net : " + summaries[Random.Shared.Next(summaries.Length)]
|
|
// ))
|
|
// .ToArray())
|
|
// )
|
|
// );
|
|
|
|
// return Task.CompletedTask;
|
|
// });
|
|
|
|
builder.AddProject<Projects.AspireApp1_Web>("webfrontend")
|
|
.WithExternalHttpEndpoints()
|
|
.WithReference(apiService);
|
|
|
|
builder.Build().Run(); |