Update REST Admin interface to support "Get Mapping(s) as C# Code" (#878)

* Add /__admin/mappings/code endpoint

* api

* fix

* .

* fix

* .

* .

* .
This commit is contained in:
Stef Heyenrath
2023-01-29 10:24:58 +01:00
committed by GitHub
parent 0fc664b404
commit 7fe2c8af78
45 changed files with 900 additions and 448 deletions

View File

@@ -1,12 +1,12 @@
#if !(NET452 || NET461 || NETCOREAPP3_1)
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Moq;
using VerifyTests;
using VerifyXunit;
using WireMock.Handlers;
using WireMock.Logging;
using WireMock.Net.Tests.VerifyExtensions;
using WireMock.Owin;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
@@ -20,6 +20,12 @@ namespace WireMock.Net.Tests;
[UsesVerify]
public class MappingBuilderTests
{
private static readonly VerifySettings VerifySettings = new();
static MappingBuilderTests()
{
VerifySettings.Init();
}
private static readonly Guid NewGuid = new("98fae52e-76df-47d9-876f-2ee32e931d9b");
private const string MappingGuid = "41372914-1838-4c67-916b-b9aacdd096ce";
private static readonly DateTime UtcNow = new(2023, 1, 14, 15, 16, 17);
@@ -67,13 +73,6 @@ public class MappingBuilderTests
);
}
[ModuleInitializer]
public static void ModuleInitializer()
{
VerifierSettings.DontScrubGuids();
VerifierSettings.DontScrubDateTimes();
}
[Fact]
public Task GetMappings()
{
@@ -81,7 +80,7 @@ public class MappingBuilderTests
var mappings = _sut.GetMappings();
// Verify
return Verifier.Verify(mappings);
return Verifier.Verify(mappings, VerifySettings);
}
[Fact]
@@ -91,7 +90,7 @@ public class MappingBuilderTests
var json = _sut.ToJson();
// Verify
return Verifier.VerifyJson(json);
return Verifier.VerifyJson(json, VerifySettings);
}
[Fact]