mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 17:28:55 +02:00
Include WireMockOpenApiParser project (#916)
* Fix some nullability warnings for WireMockOpenApiParser * . * . * . * opt * FromText * ab * . * private const string AdminOpenApi = "/__admin/openapi"; * fix test * rnd * . * urldetails * 0 * , * . * tests * . * CompressionUtilsTests * ut * .
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
@@ -760,5 +761,81 @@ public class WireMockAdminApiTests
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_OpenApiConvert_Yml()
|
||||
{
|
||||
// Arrange
|
||||
var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore.yml"));
|
||||
|
||||
var server = WireMockServer.StartWithAdminInterface();
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var mappings = await api.OpenApiConvertAsync(openApiDocument).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
server.MappingModels.Should().BeEmpty();
|
||||
mappings.Should().HaveCount(20);
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_OpenApiConvert_Json()
|
||||
{
|
||||
// Arrange
|
||||
var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore-openapi3.json"));
|
||||
|
||||
var server = WireMockServer.StartWithAdminInterface();
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var mappings = await api.OpenApiConvertAsync(openApiDocument).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
server.MappingModels.Should().BeEmpty();
|
||||
mappings.Should().HaveCount(19);
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_OpenApiSave_Json()
|
||||
{
|
||||
// Arrange
|
||||
var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore-openapi3.json"));
|
||||
|
||||
var server = WireMockServer.StartWithAdminInterface();
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var statusModel = await api.OpenApiSaveAsync(openApiDocument).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
statusModel.Status.Should().Be("OpenApi document converted to Mappings");
|
||||
server.MappingModels.Should().HaveCount(19);
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_OpenApiSave_Yml()
|
||||
{
|
||||
// Arrange
|
||||
var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore.yml"));
|
||||
|
||||
var server = WireMockServer.StartWithAdminInterface();
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var mappings = await api.OpenApiConvertAsync(openApiDocument).ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
server.MappingModels.Should().BeEmpty();
|
||||
mappings.Should().HaveCount(20);
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user