mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 17:28:55 +02:00
Correctly map the Pact Interaction Description property (#1331)
* Correctly map the Pact Interaction Description property * Update src/WireMock.Net.Minimal/Serialization/PactMapper.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * post --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using VerifyXunit;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -14,10 +17,11 @@ using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Pact;
|
||||
|
||||
[UsesVerify]
|
||||
public class PactTests
|
||||
{
|
||||
[Fact]
|
||||
public void SavePact_Get_Request_And_Response_WithBodyAsJson()
|
||||
public async Task SavePact_Get_Request_And_Response_WithBodyAsJson()
|
||||
{
|
||||
var server = WireMockServer.Start();
|
||||
server
|
||||
@@ -46,12 +50,34 @@ public class PactTests
|
||||
|
||||
var folder = Path.Combine("../../../", "Pact", "files");
|
||||
var file = "pact-get.json";
|
||||
var path = Path.Combine(folder, file);
|
||||
|
||||
// Act
|
||||
server.SavePact(folder, file);
|
||||
|
||||
// Assert
|
||||
File.ReadAllBytes(Path.Combine(folder, file)).Length.Should().BeGreaterThan(1);
|
||||
await Verifier.VerifyFile(path);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SavePact_Post_Request_WithDescription()
|
||||
{
|
||||
var server = WireMockServer.Start();
|
||||
server
|
||||
.Given(Request.Create().UsingPost().WithPath("/tester"))
|
||||
.WithTitle("POST something")
|
||||
.WithDescription("A POST request to change something")
|
||||
.RespondWith(Response.Create().WithStatusCode(HttpStatusCode.OK));
|
||||
|
||||
var folder = Path.Combine("../../../", "Pact", "files");
|
||||
var file = "pact-post.json";
|
||||
var path = Path.Combine(folder, file);
|
||||
|
||||
// Act
|
||||
server.SavePact(folder, file);
|
||||
|
||||
// Assert
|
||||
await Verifier.VerifyFile(path);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -219,4 +245,5 @@ public class PactTests
|
||||
// Assert
|
||||
File.ReadAllBytes(Path.Combine(folder, file)).Length.Should().BeGreaterThan(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user