mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-22 08:18:26 +02:00
@@ -55,6 +55,7 @@ namespace WireMock.Client
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mapping">MappingModel</param>
|
/// <param name="mapping">MappingModel</param>
|
||||||
[Post("__admin/mappings")]
|
[Post("__admin/mappings")]
|
||||||
|
[Header("Content-Type", "application/json")]
|
||||||
Task<string> PostMappingAsync([Body] MappingModel mapping);
|
Task<string> PostMappingAsync([Body] MappingModel mapping);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -137,6 +138,7 @@ namespace WireMock.Client
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model">The RequestModel</param>
|
/// <param name="model">The RequestModel</param>
|
||||||
[Post("__admin/requests/find")]
|
[Post("__admin/requests/find")]
|
||||||
|
[Header("Content-Type", "application/json")]
|
||||||
Task<IList<LogEntryModel>> FindRequestsAsync([Body] RequestModel model);
|
Task<IList<LogEntryModel>> FindRequestsAsync([Body] RequestModel model);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
48
test/WireMock.Net.Tests/ClientTests.cs
Normal file
48
test/WireMock.Net.Tests/ClientTests.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NFluent;
|
||||||
|
using RestEase;
|
||||||
|
using WireMock.Admin.Mappings;
|
||||||
|
using WireMock.Client;
|
||||||
|
using WireMock.Server;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace WireMock.Net.Tests
|
||||||
|
{
|
||||||
|
public class ClientTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task Client_IFluentMockServerAdmin_PostMappingAsync()
|
||||||
|
{
|
||||||
|
// Assign
|
||||||
|
var server = FluentMockServer.StartWithAdminInterface();
|
||||||
|
var api = RestClient.For<IFluentMockServerAdmin>(server.Urls[0]);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var model = new MappingModel
|
||||||
|
{
|
||||||
|
Request = new RequestModel
|
||||||
|
{
|
||||||
|
Path = "/1"
|
||||||
|
},
|
||||||
|
Response = new ResponseModel
|
||||||
|
{
|
||||||
|
Body = "txt",
|
||||||
|
StatusCode = 200
|
||||||
|
},
|
||||||
|
Priority = 500,
|
||||||
|
Title = "test"
|
||||||
|
};
|
||||||
|
string result = await api.PostMappingAsync(model);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Check.That(result).IsNotNull();
|
||||||
|
|
||||||
|
var mapping = server.Mappings.Single(m => m.Priority == 500);
|
||||||
|
Check.That(mapping).IsNotNull();
|
||||||
|
Check.That(mapping.Title).Equals("test");
|
||||||
|
|
||||||
|
server.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user