mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-24 09:18:27 +02:00
ct
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System.Threading.Tasks;
|
||||
using RestEase;
|
||||
using VerifyXunit;
|
||||
using WireMock.Client;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Server;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.AdminApi;
|
||||
|
||||
@@ -149,5 +145,4 @@ message HelloReply {
|
||||
|
||||
return server;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1,11 +1,7 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
@@ -16,7 +12,6 @@ using WireMock.Client;
|
||||
using WireMock.Constants;
|
||||
using WireMock.Models;
|
||||
using WireMock.Server;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.AdminApi;
|
||||
|
||||
@@ -37,17 +32,18 @@ public partial class WireMockAdminApiTests
|
||||
public async Task HttpClient_PostMappingsAsync_ForProtoBufMapping(string mappingFile, string guid)
|
||||
{
|
||||
// Arrange
|
||||
var cancelationToken = TestContext.Current.CancellationToken;
|
||||
var mappingsJson = ReadMappingFile(mappingFile);
|
||||
|
||||
using var server = WireMockServer.StartWithAdminInterface();
|
||||
var httpClient = server.CreateClient();
|
||||
|
||||
// Act
|
||||
var result = await httpClient.PostAsync("/__admin/mappings", new StringContent(mappingsJson, Encoding.UTF8, WireMockConstants.ContentTypeJson));
|
||||
var result = await httpClient.PostAsync("/__admin/mappings", new StringContent(mappingsJson, Encoding.UTF8, WireMockConstants.ContentTypeJson), cancelationToken);
|
||||
result.EnsureSuccessStatusCode();
|
||||
|
||||
// Assert
|
||||
var mapping = await httpClient.GetStringAsync($"/__admin/mappings/{guid}");
|
||||
var mapping = await httpClient.GetStringAsync($"/__admin/mappings/{guid}", cancelationToken);
|
||||
mapping = RemoveLineContainingUpdatedAt(mapping);
|
||||
mapping.Should().Be(mappingsJson);
|
||||
}
|
||||
@@ -174,5 +170,4 @@ public partial class WireMockAdminApiTests
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user