mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-23 17:41:01 +01:00
remove nfluent
This commit is contained in:
@@ -2,10 +2,9 @@
|
||||
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
|
||||
using RestEase;
|
||||
using WireMock.Admin.Mappings;
|
||||
using WireMock.Client;
|
||||
@@ -73,12 +72,12 @@ public partial class WireMockAdminApiTests
|
||||
var result = await api.PostMappingsAsync([model1, model2], TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsNotNull();
|
||||
Check.That(result.Status).IsNotNull();
|
||||
Check.That(result.Guid).IsNull();
|
||||
Check.That(server.Mappings.Where(m => !m.IsAdminInterface)).HasSize(2);
|
||||
Check.That(server.Mappings.Single(x => x.Title == "test 1").Description).IsEqualTo("description 1");
|
||||
Check.That(server.Mappings.Single(x => x.Title == "test 2").Description).IsEqualTo("description 2");
|
||||
result.Should().NotBeNull();
|
||||
result.Status.Should().NotBeNull();
|
||||
result.Guid.Should().BeNull();
|
||||
server.Mappings.Where(m => !m.IsAdminInterface).Should().HaveCount(2);
|
||||
server.Mappings.Single(x => x.Title == "test 1").Description.Should().Be("description 1");
|
||||
server.Mappings.Single(x => x.Title == "test 2").Description.Should().Be("description 2");
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
@@ -106,16 +105,16 @@ public partial class WireMockAdminApiTests
|
||||
var result = await api.PostMappingAsync(model, TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsNotNull();
|
||||
Check.That(result.Status).IsNotNull();
|
||||
Check.That(result.Guid).IsNotNull();
|
||||
result.Should().NotBeNull();
|
||||
result.Status.Should().NotBeNull();
|
||||
result.Guid.Should().NotBeNull();
|
||||
|
||||
var mapping = server.Mappings.Single(m => m.Priority == 500);
|
||||
Check.That(mapping).IsNotNull();
|
||||
Check.That(mapping.Title).Equals("test");
|
||||
mapping.Should().NotBeNull();
|
||||
mapping.Title.Should().Be("test");
|
||||
|
||||
var response = await mapping.ProvideResponseAsync(Mock.Of<HttpContext>(), new RequestMessage(new UrlDetails("http://localhost/1"), "GET", ""));
|
||||
Check.That(response.Message.StatusCode).Equals(expectedStatusCode);
|
||||
response.Message.StatusCode.Should().Be(expectedStatusCode);
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
using RestEase;
|
||||
using WireMock.Admin.Mappings;
|
||||
using WireMock.Admin.Scenarios;
|
||||
@@ -94,7 +92,7 @@ public partial class WireMockAdminApiTests
|
||||
|
||||
// Act
|
||||
var settings = await api.GetSettingsAsync(TestContext.Current.CancellationToken);
|
||||
Check.That(settings).IsNotNull();
|
||||
settings.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -112,7 +110,7 @@ public partial class WireMockAdminApiTests
|
||||
var settings = await api.GetSettingsAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(settings).IsNotNull();
|
||||
settings.Should().NotBeNull();
|
||||
|
||||
// Cleanup
|
||||
server.Stop();
|
||||
@@ -129,7 +127,7 @@ public partial class WireMockAdminApiTests
|
||||
// Act
|
||||
var settings = new SettingsModel();
|
||||
var status = await api.PostSettingsAsync(settings, TestContext.Current.CancellationToken);
|
||||
Check.That(status.Status).Equals("Settings updated");
|
||||
status.Status.Should().Be("Settings updated");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -142,7 +140,7 @@ public partial class WireMockAdminApiTests
|
||||
// Act
|
||||
var settings = new SettingsModel();
|
||||
var status = await api.PutSettingsAsync(settings, TestContext.Current.CancellationToken);
|
||||
Check.That(status.Status).Equals("Settings updated");
|
||||
status.Status.Should().Be("Settings updated");
|
||||
}
|
||||
|
||||
// https://github.com/wiremock/WireMock.Net/issues/325
|
||||
@@ -164,13 +162,13 @@ public partial class WireMockAdminApiTests
|
||||
var result = await api.PutMappingAsync(new Guid("a0000000-0000-0000-0000-000000000000"), model, TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsNotNull();
|
||||
Check.That(result.Status).Equals("Mapping added or updated");
|
||||
Check.That(result.Guid).IsNotNull();
|
||||
result.Should().NotBeNull();
|
||||
result.Status.Should().Be("Mapping added or updated");
|
||||
result.Guid.Should().NotBeNull();
|
||||
|
||||
var mapping = server.Mappings.Single(m => m.Priority == 500);
|
||||
Check.That(mapping).IsNotNull();
|
||||
Check.That(mapping.Title).Equals("test");
|
||||
mapping.Should().NotBeNull();
|
||||
mapping.Title.Should().Be("test");
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
@@ -202,7 +200,7 @@ public partial class WireMockAdminApiTests
|
||||
// Assert
|
||||
requests.Should().HaveCount(1);
|
||||
var requestLogged = requests.First();
|
||||
requestLogged.Request.Method.Should().Be("GET");
|
||||
requestLogged.Request!.Method.Should().Be("GET");
|
||||
requestLogged.Request.Body.Should().BeNull();
|
||||
requestLogged.Request.Path.Should().Be("/foo");
|
||||
}
|
||||
@@ -235,15 +233,15 @@ public partial class WireMockAdminApiTests
|
||||
// Assert
|
||||
logEntryModels.Should().HaveCount(2);
|
||||
logEntryModels[0].Should().NotBeNull();
|
||||
logEntryModels[0]!.Request.Method.Should().Be("GET");
|
||||
logEntryModels[0]!.Request.Body.Should().BeNull();
|
||||
logEntryModels[0]!.Request.Path.Should().Be("/foo");
|
||||
logEntryModels[0]!.Request.Query.Should().BeNullOrEmpty();
|
||||
logEntryModels[0].Request!.Method.Should().Be("GET");
|
||||
logEntryModels[0].Request!.Body.Should().BeNull();
|
||||
logEntryModels[0].Request!.Path.Should().Be("/foo");
|
||||
logEntryModels[0].Request!.Query.Should().BeNullOrEmpty();
|
||||
logEntryModels[1].Should().NotBeNull();
|
||||
logEntryModels[1]!.Request.Method.Should().Be("GET");
|
||||
logEntryModels[1]!.Request.Body.Should().BeNull();
|
||||
logEntryModels[1]!.Request.Path.Should().Be("/foo");
|
||||
logEntryModels[1]!.Request.Query.Should().BeEquivalentTo(new Dictionary<string, WireMockList<string>>
|
||||
logEntryModels[1].Request!.Method.Should().Be("GET");
|
||||
logEntryModels[1].Request!.Body.Should().BeNull();
|
||||
logEntryModels[1].Request!.Path.Should().Be("/foo");
|
||||
logEntryModels[1].Request!.Query.Should().BeEquivalentTo(new Dictionary<string, WireMockList<string>>
|
||||
{
|
||||
{"bar", new WireMockList<string>("baz")}
|
||||
});
|
||||
@@ -312,11 +310,11 @@ public partial class WireMockAdminApiTests
|
||||
var requests = await api.GetRequestsAsync(cancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(requests).HasSize(1);
|
||||
requests.Should().HaveCount(1);
|
||||
var requestLogged = requests.First();
|
||||
Check.That(requestLogged.Request.Method).IsEqualTo("GET");
|
||||
Check.That(requestLogged.Request.Body).IsNull();
|
||||
Check.That(requestLogged.Request.Path).IsEqualTo("/foo");
|
||||
requestLogged.Request.Method.Should().Be("GET");
|
||||
requestLogged.Request.Body.Should().BeNull();
|
||||
requestLogged.Request.Path.Should().Be("/foo");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -342,7 +340,7 @@ public partial class WireMockAdminApiTests
|
||||
|
||||
using var client = new HttpClient();
|
||||
var response = await client.SendAsync(request, cancellationToken);
|
||||
Check.That(response).IsNotNull();
|
||||
response.Should().NotBeNull();
|
||||
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
|
||||
@@ -350,11 +348,11 @@ public partial class WireMockAdminApiTests
|
||||
var requests = await api.GetRequestsAsync(cancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(requests).HasSize(1);
|
||||
requests.Should().HaveCount(1);
|
||||
var requestLogged = requests.First();
|
||||
Check.That(requestLogged.Request.Method).IsEqualTo("POST");
|
||||
Check.That(requestLogged.Request.Body).IsNotNull();
|
||||
Check.That(requestLogged.Request.Body).Contains("T000001");
|
||||
requestLogged.Request.Method.Should().Be("POST");
|
||||
requestLogged.Request.Body.Should().NotBeNull();
|
||||
requestLogged.Request.Body.Should().Contain("T000001");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -524,7 +522,7 @@ public partial class WireMockAdminApiTests
|
||||
request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(jsonApiContentType);
|
||||
using var client = new HttpClient();
|
||||
var response = await client.SendAsync(request, cancellationToken);
|
||||
Check.That(response).IsNotNull();
|
||||
response.Should().NotBeNull();
|
||||
|
||||
var api = RestClient.For<IWireMockAdminApi>(serverUrl);
|
||||
|
||||
@@ -532,11 +530,11 @@ public partial class WireMockAdminApiTests
|
||||
var requests = await api.GetRequestsAsync(cancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(requests).HasSize(1);
|
||||
requests.Should().HaveCount(1);
|
||||
var requestLogged = requests.First();
|
||||
Check.That(requestLogged.Request.Method).IsEqualTo("POST");
|
||||
Check.That(requestLogged.Request.Body).IsNotNull();
|
||||
Check.That(requestLogged.Request.Body).Contains("T000001");
|
||||
requestLogged.Request.Method.Should().Be("POST");
|
||||
requestLogged.Request.Body.Should().NotBeNull();
|
||||
requestLogged.Request.Body.Should().Contain("T000001");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -561,8 +559,8 @@ public partial class WireMockAdminApiTests
|
||||
var request = await api.PostFileAsync("filename.txt", "abc", TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(request.Guid).IsNull();
|
||||
Check.That(request.Status).Contains("File");
|
||||
request.Guid.Should().BeNull();
|
||||
request.Status.Should().Contain("File");
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.GetMappingFolder(), Times.Once);
|
||||
@@ -594,8 +592,8 @@ public partial class WireMockAdminApiTests
|
||||
var request = await api.PutFileAsync("filename.txt", "abc-abc", TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(request.Guid).IsNull();
|
||||
Check.That(request.Status).Contains("File");
|
||||
request.Guid.Should().BeNull();
|
||||
request.Status.Should().Contain("File");
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.WriteFile(It.Is<string>(p => p == "filename.txt"), It.IsAny<byte[]>()), Times.Once);
|
||||
@@ -606,7 +604,7 @@ public partial class WireMockAdminApiTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IWireMockAdminApi_PutFileAsync_NotFound()
|
||||
public async Task IWireMockAdminApi_PutFileAsync_NotFound()
|
||||
{
|
||||
// Arrange
|
||||
var filesystemHandlerMock = new Mock<IFileSystemHandler>(MockBehavior.Strict);
|
||||
@@ -622,7 +620,8 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatCode(() => api.PutFileAsync("filename.txt", "xxx", TestContext.Current.CancellationToken)).Throws<ApiException>();
|
||||
Func<Task> act = () => api.PutFileAsync("filename.txt", "xxx", TestContext.Current.CancellationToken);
|
||||
await act.Should().ThrowAsync<ApiException>();
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is<string>(p => p == "filename.txt")), Times.Once);
|
||||
@@ -632,7 +631,7 @@ public partial class WireMockAdminApiTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IWireMockAdminApi_GetFileAsync_NotFound()
|
||||
public async Task IWireMockAdminApi_GetFileAsync_NotFound()
|
||||
{
|
||||
// Arrange
|
||||
var filesystemHandlerMock = new Mock<IFileSystemHandler>(MockBehavior.Strict);
|
||||
@@ -649,7 +648,8 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatCode(() => api.GetFileAsync("filename.txt", TestContext.Current.CancellationToken)).Throws<ApiException>();
|
||||
Func<Task> act = () => api.GetFileAsync("filename.txt", TestContext.Current.CancellationToken);
|
||||
await act.Should().ThrowAsync<ApiException>();
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is<string>(p => p == "filename.txt")), Times.Once);
|
||||
@@ -680,7 +680,7 @@ public partial class WireMockAdminApiTests
|
||||
string file = await api.GetFileAsync("filename.txt", TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(file).Equals(data);
|
||||
file.Should().Be(data);
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is<string>(p => p == "filename.txt")), Times.Once);
|
||||
@@ -719,7 +719,7 @@ public partial class WireMockAdminApiTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IWireMockAdminApi_DeleteFileAsync_NotFound()
|
||||
public async Task IWireMockAdminApi_DeleteFileAsync_NotFound()
|
||||
{
|
||||
// Arrange
|
||||
var filesystemHandlerMock = new Mock<IFileSystemHandler>(MockBehavior.Strict);
|
||||
@@ -736,7 +736,8 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatCode(() => api.DeleteFileAsync("filename.txt", TestContext.Current.CancellationToken)).Throws<ApiException>();
|
||||
Func<Task> act = () => api.DeleteFileAsync("filename.txt", TestContext.Current.CancellationToken);
|
||||
await act.Should().ThrowAsync<ApiException>();
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is<string>(p => p == "filename.txt")), Times.Once);
|
||||
@@ -746,7 +747,7 @@ public partial class WireMockAdminApiTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IWireMockAdminApi_FileExistsAsync_NotFound()
|
||||
public async Task IWireMockAdminApi_FileExistsAsync_NotFound()
|
||||
{
|
||||
// Arrange
|
||||
var filesystemHandlerMock = new Mock<IFileSystemHandler>(MockBehavior.Strict);
|
||||
@@ -762,7 +763,8 @@ public partial class WireMockAdminApiTests
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0]);
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatCode(() => api.FileExistsAsync("filename.txt", TestContext.Current.CancellationToken)).Throws<ApiException>();
|
||||
Func<Task> act = () => api.FileExistsAsync("filename.txt", TestContext.Current.CancellationToken);
|
||||
await act.Should().ThrowAsync<ApiException>();
|
||||
|
||||
// Verify
|
||||
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is<string>(p => p == "filename.txt")), Times.Once);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Client;
|
||||
using WireMock.Client.Extensions;
|
||||
using WireMock.Net.Tests.VerifyExtensions;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Collections;
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Extensions;
|
||||
|
||||
namespace WireMock.Net.Tests.Extensions;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Extensions;
|
||||
|
||||
namespace WireMock.Net.Tests.Extensions;
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using AwesomeAssertions;
|
||||
using RestEase;
|
||||
using WireMock.Client;
|
||||
using WireMock.Client.AwesomeAssertions;
|
||||
@@ -670,7 +669,6 @@ public class WireMockAdminApiAssertionsTests : IDisposable
|
||||
.WithMessage("Expected _adminApi to have been called using method \"OPTIONS\", but didn't find it among the methods {\"POST\"}.");
|
||||
}
|
||||
|
||||
#if !NET452
|
||||
[Fact]
|
||||
public async Task HaveReceivedACall_UsingConnect_WhenACallWasMadeUsingConnect_Should_BeOK()
|
||||
{
|
||||
@@ -686,7 +684,6 @@ public class WireMockAdminApiAssertionsTests : IDisposable
|
||||
.HaveReceivedACall()
|
||||
.UsingConnect();
|
||||
}
|
||||
#endif
|
||||
|
||||
[Fact]
|
||||
public async Task HaveReceivedACall_UsingDelete_WhenACallWasMadeUsingDelete_Should_BeOK()
|
||||
@@ -764,7 +761,7 @@ public class WireMockAdminApiAssertionsTests : IDisposable
|
||||
.RespondWith(Response.Create().WithBody("C response").WithStatusCode(HttpStatusCode.OK));
|
||||
|
||||
// Act
|
||||
var httpClient = new HttpClient();
|
||||
using var httpClient = new HttpClient();
|
||||
|
||||
var tasks = new[]
|
||||
{
|
||||
@@ -902,7 +899,7 @@ public class WireMockAdminApiAssertionsTests : IDisposable
|
||||
.RespondWith(Response.Create().WithBody("A response"));
|
||||
|
||||
// Act
|
||||
var httpClient = new HttpClient();
|
||||
using var httpClient = new HttpClient();
|
||||
|
||||
await httpClient.PostAsync($"{server.Url}/a", new StringContent("x"), _ct);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using AwesomeAssertions;
|
||||
using WireMock.AwesomeAssertions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.RequestBuilders;
|
||||
@@ -407,7 +406,7 @@ public class WireMockAssertionsTests : IDisposable
|
||||
|
||||
act.Should()
|
||||
.Throw<Exception>()
|
||||
.WithMessage("Expected _server to have been called with Header \"Accept\" and Values {\"missing-value\"}, but didn't find it among the calls with Header(s)*");
|
||||
.WithMessage("Expected _server to have been called with Header \"Accept\" and Values {\"missing-value\"}, but didn't find it among the calls with Header*");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -653,7 +652,6 @@ public class WireMockAssertionsTests : IDisposable
|
||||
.WithMessage("Expected _server to have been called using method \"OPTIONS\", but didn't find it among the methods {\"POST\"}.");
|
||||
}
|
||||
|
||||
#if !NET452
|
||||
[Fact]
|
||||
public async Task HaveReceivedACall_UsingConnect_WhenACallWasMadeUsingConnect_Should_BeOK()
|
||||
{
|
||||
@@ -669,7 +667,6 @@ public class WireMockAssertionsTests : IDisposable
|
||||
.HaveReceivedACall()
|
||||
.UsingConnect();
|
||||
}
|
||||
#endif
|
||||
|
||||
[Fact]
|
||||
public async Task HaveReceivedACall_UsingDelete_WhenACallWasMadeUsingDelete_Should_BeOK()
|
||||
|
||||
1
test/WireMock.Net.Tests/GlobalUsings.cs
Normal file
1
test/WireMock.Net.Tests/GlobalUsings.cs
Normal file
@@ -0,0 +1 @@
|
||||
global using AwesomeAssertions;
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Util;
|
||||
|
||||
namespace WireMock.Net.Tests.Grpc;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Util;
|
||||
|
||||
namespace WireMock.Net.Tests.Grpc;
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using ExampleIntegrationTest.Lookup;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using Greet;
|
||||
@@ -15,7 +14,6 @@ using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Server;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Util;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace WireMock.Net.Tests;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
|
||||
namespace WireMock.Net.Tests.Handlers;
|
||||
@@ -16,28 +16,31 @@ public class LocalFileSystemHandlerTests
|
||||
string result = _sut.GetMappingFolder();
|
||||
|
||||
// Assert
|
||||
Check.That(result).EndsWith(Path.Combine("__admin", "mappings"));
|
||||
result.Should().EndWith(Path.Combine("__admin", "mappings"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LocalFileSystemHandler_CreateFolder_ThrowsArgumentNullException()
|
||||
{
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.CreateFolder(null)).Throws<ArgumentNullException>();
|
||||
Action act = () => _sut.CreateFolder(null);
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LocalFileSystemHandler_WriteMappingFile_ThrowsArgumentNullException()
|
||||
{
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.WriteMappingFile(null, null)).Throws<ArgumentNullException>();
|
||||
Action act = () => _sut.WriteMappingFile(null, null);
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LocalFileSystemHandler_ReadResponseBodyAsFile_ThrowsArgumentNullException()
|
||||
{
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.ReadResponseBodyAsFile(null)).Throws<ArgumentNullException>();
|
||||
Action act = () => _sut.ReadResponseBodyAsFile(null);
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -47,42 +50,47 @@ public class LocalFileSystemHandlerTests
|
||||
var result = _sut.FileExists("x.x");
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsFalse();
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LocalFileSystemHandler_FileExists_ThrowsArgumentNullException()
|
||||
{
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.FileExists(null)).Throws<ArgumentNullException>();
|
||||
Action act = () => _sut.FileExists(null);
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LocalFileSystemHandler_ReadFile_ThrowsArgumentNullException()
|
||||
{
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.ReadFile(null)).Throws<ArgumentNullException>();
|
||||
Action act = () => _sut.ReadFile(null);
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LocalFileSystemHandler_ReadFileAsString_ThrowsArgumentNullException()
|
||||
{
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.ReadFileAsString(null)).Throws<ArgumentNullException>();
|
||||
Action act = () => _sut.ReadFileAsString(null);
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LocalFileSystemHandler_WriteFile_ThrowsArgumentNullException()
|
||||
{
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.WriteFile(null, null)).Throws<ArgumentNullException>();
|
||||
Action act = () => _sut.WriteFile(null, null);
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LocalFileSystemHandler_DeleteFile_ThrowsArgumentNullException()
|
||||
{
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.DeleteFile(null)).Throws<ArgumentNullException>();
|
||||
Action act = () => _sut.DeleteFile(null);
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -92,13 +100,17 @@ public class LocalFileSystemHandlerTests
|
||||
string result = _sut.GetUnmatchedRequestsFolder();
|
||||
|
||||
// Assert
|
||||
Check.That(result).EndsWith(Path.Combine("requests", "unmatched"));
|
||||
result.Should().EndWith(Path.Combine("requests", "unmatched"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LocalFileSystemHandler_WriteUnmatchedRequest()
|
||||
{
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.WriteUnmatchedRequest(null, null)).Throws<ArgumentNullException>();
|
||||
Action act = () => _sut.WriteUnmatchedRequest(null, null);
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Http;
|
||||
|
||||
namespace WireMock.Net.Tests.Http;
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Http;
|
||||
using WireMock.Models;
|
||||
using WireMock.Types;
|
||||
@@ -28,7 +27,7 @@ public class HttpRequestMessageHelperTests
|
||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||
|
||||
// Assert
|
||||
Check.That(message.Headers.GetValues("x")).ContainsExactly("value-1");
|
||||
message.Headers.GetValues("x").Should().Equal(new[] { "value-1" });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -46,7 +45,7 @@ public class HttpRequestMessageHelperTests
|
||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||
|
||||
// Assert
|
||||
Check.That(await message.Content!.ReadAsByteArrayAsync(_ct)).ContainsExactly(Encoding.UTF8.GetBytes("hi"));
|
||||
(await message.Content!.ReadAsByteArrayAsync(_ct)).Should().Equal(Encoding.UTF8.GetBytes("hi"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -64,7 +63,7 @@ public class HttpRequestMessageHelperTests
|
||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||
|
||||
// Assert
|
||||
Check.That(await message.Content!.ReadAsStringAsync(_ct)).Equals("0123");
|
||||
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be("0123");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -82,7 +81,7 @@ public class HttpRequestMessageHelperTests
|
||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||
|
||||
// Assert
|
||||
Check.That(await message.Content!.ReadAsStringAsync(_ct)).Equals("{\"x\":42}");
|
||||
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be("{\"x\":42}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -101,8 +100,8 @@ public class HttpRequestMessageHelperTests
|
||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||
|
||||
// Assert
|
||||
Check.That(await message.Content!.ReadAsStringAsync(_ct)).Equals("{\"x\":42}");
|
||||
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("application/json");
|
||||
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be("{\"x\":42}");
|
||||
message.Content.Headers.GetValues("Content-Type").Should().Equal(new[] { "application/json" });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -121,8 +120,8 @@ public class HttpRequestMessageHelperTests
|
||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||
|
||||
// Assert
|
||||
Check.That(await message.Content!.ReadAsStringAsync(_ct)).Equals("{\"x\":42}");
|
||||
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("application/json; charset=utf-8");
|
||||
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be("{\"x\":42}");
|
||||
message.Content.Headers.GetValues("Content-Type").Should().Equal(new[] { "application/json; charset=utf-8" });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -142,8 +141,8 @@ public class HttpRequestMessageHelperTests
|
||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||
|
||||
// Assert
|
||||
Check.That(await message.Content!.ReadAsStringAsync(_ct)).Equals("{\"x\":42}");
|
||||
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("multipart/form-data");
|
||||
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be("{\"x\":42}");
|
||||
message.Content.Headers.GetValues("Content-Type").Should().Equal(new[] { "multipart/form-data" });
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +162,7 @@ public class HttpRequestMessageHelperTests
|
||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||
|
||||
// Assert
|
||||
Check.That(message.Content!.Headers.GetValues("Content-Type")).ContainsExactly("application/xml");
|
||||
message.Content!.Headers.GetValues("Content-Type").Should().Equal(new[] { "application/xml" });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -182,7 +181,7 @@ public class HttpRequestMessageHelperTests
|
||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||
|
||||
// Assert
|
||||
Check.That(message.Content!.Headers.GetValues("Content-Type")).ContainsExactly("application/xml; charset=UTF-8");
|
||||
message.Content!.Headers.GetValues("Content-Type").Should().Equal(new[] { "application/xml; charset=UTF-8" });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -201,7 +200,7 @@ public class HttpRequestMessageHelperTests
|
||||
var message = HttpRequestMessageHelper.Create(request, "http://url");
|
||||
|
||||
// Assert
|
||||
Check.That(message.Content!.Headers.GetValues("Content-Type")).ContainsExactly("application/xml; charset=Ascii");
|
||||
message.Content!.Headers.GetValues("Content-Type").Should().Equal(new[] { "application/xml; charset=Ascii" });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -243,7 +242,7 @@ public class HttpRequestMessageHelperTests
|
||||
|
||||
// Assert
|
||||
(await message.Content!.ReadAsStringAsync(_ct)).Should().Be(body);
|
||||
Check.That(message.Content.Headers.GetValues("Content-Type")).ContainsExactly("multipart/form-data");
|
||||
message.Content.Headers.GetValues("Content-Type").Should().Equal(new[] { "multipart/form-data" });
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -270,4 +269,7 @@ public class HttpRequestMessageHelperTests
|
||||
// Assert
|
||||
message.Content?.Headers.ContentLength.Should().Be(resultShouldBe ? value : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Http;
|
||||
|
||||
namespace WireMock.Net.Tests.Http;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -79,7 +77,7 @@ public class CSharpCodeMatcherTests
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("CSharpCodeMatcher");
|
||||
name.Should().Be("CSharpCodeMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -92,6 +90,6 @@ public class CSharpCodeMatcherTests
|
||||
var patterns = matcher.GetPatterns();
|
||||
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly("x");
|
||||
patterns.Should().ContainSingle("x");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -51,7 +49,7 @@ public class ContentTypeMatcherTests
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("ContentTypeMatcher");
|
||||
name.Should().Be("ContentTypeMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -64,6 +62,6 @@ public class ContentTypeMatcherTests
|
||||
var patterns = matcher.GetPatterns();
|
||||
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly("x");
|
||||
patterns.Should().ContainSingle("x");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -17,7 +16,7 @@ public class ExactMatcherTests
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("ExactMatcher");
|
||||
name.Should().Be("ExactMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -30,7 +29,7 @@ public class ExactMatcherTests
|
||||
var patterns = matcher.GetPatterns();
|
||||
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly("X");
|
||||
patterns.Should().ContainSingle("X");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -43,7 +42,7 @@ public class ExactMatcherTests
|
||||
double result = matcher.IsMatch("X").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
result.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -56,7 +55,7 @@ public class ExactMatcherTests
|
||||
double result = matcher.IsMatch("x").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
result.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -69,7 +68,7 @@ public class ExactMatcherTests
|
||||
double result = matcher.IsMatch("y").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(0.0);
|
||||
result.Should().Be(0.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -82,7 +81,7 @@ public class ExactMatcherTests
|
||||
double result = matcher.IsMatch("x").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
result.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -95,7 +94,7 @@ public class ExactMatcherTests
|
||||
double result = matcher.IsMatch("x").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
result.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -111,7 +110,7 @@ public class ExactMatcherTests
|
||||
double result = matcher.IsMatch("x").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(score);
|
||||
result.Should().Be(score);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -124,7 +123,7 @@ public class ExactMatcherTests
|
||||
double result = matcher.IsMatch("caR").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(0.0);
|
||||
result.Should().Be(0.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -137,7 +136,7 @@ public class ExactMatcherTests
|
||||
double result = matcher.IsMatch("cat").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
result.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -150,6 +149,6 @@ public class ExactMatcherTests
|
||||
double result = matcher.IsMatch("cat").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(0.0);
|
||||
result.Should().Be(0.0);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -18,7 +18,7 @@ public class ExactObjectMatcherTests
|
||||
var name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("ExactObjectMatcher");
|
||||
name.Should().Be("ExactObjectMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -32,7 +32,7 @@ public class ExactObjectMatcherTests
|
||||
var score = matcher.IsMatch(checkValue).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0);
|
||||
score.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -46,7 +46,7 @@ public class ExactObjectMatcherTests
|
||||
var score = matcher.IsMatch(new { x = 500, s = "s" }).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0);
|
||||
score.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -60,6 +60,6 @@ public class ExactObjectMatcherTests
|
||||
var score = matcher.IsMatch(new { x = 500, s = "s" }).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.0);
|
||||
score.Should().Be(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System.Net.Http;
|
||||
using AnyOfTypes;
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Models;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using GraphQLParser.Exceptions;
|
||||
using WireMock.Exceptions;
|
||||
using WireMock.Matchers;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -19,7 +18,7 @@ public class JmesPathMatcherTests
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("JmesPathMatcher");
|
||||
name.Should().Be("JmesPathMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -32,7 +31,7 @@ public class JmesPathMatcherTests
|
||||
var patterns = matcher.GetPatterns();
|
||||
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly("X");
|
||||
patterns.Should().ContainSingle("X");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -46,7 +45,7 @@ public class JmesPathMatcherTests
|
||||
double match = matcher.IsMatch(bytes).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -59,7 +58,7 @@ public class JmesPathMatcherTests
|
||||
double match = matcher.IsMatch(null).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -72,7 +71,7 @@ public class JmesPathMatcherTests
|
||||
double match = matcher.IsMatch(string.Empty).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -86,7 +85,7 @@ public class JmesPathMatcherTests
|
||||
double match = matcher.IsMatch(o).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -99,7 +98,7 @@ public class JmesPathMatcherTests
|
||||
double match = matcher.IsMatch("").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -112,7 +111,7 @@ public class JmesPathMatcherTests
|
||||
double match = matcher.IsMatch("x").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -125,7 +124,7 @@ public class JmesPathMatcherTests
|
||||
double match = matcher.IsMatch(new { things = new { name = "RequiredThing" } }).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1);
|
||||
match.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -148,7 +147,7 @@ public class JmesPathMatcherTests
|
||||
double match = matcher.IsMatch(jobject).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1);
|
||||
match.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -161,7 +160,7 @@ public class JmesPathMatcherTests
|
||||
double match = matcher.IsMatch(JObject.Parse("{ \"things\": { \"x\": \"RequiredThing\" } }")).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1);
|
||||
match.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -174,7 +173,7 @@ public class JmesPathMatcherTests
|
||||
double match = matcher.IsMatch(JObject.Parse("{ \"things\": { \"x\": \"RequiredThing\" } }")).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0.0);
|
||||
match.Should().Be(0.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -202,4 +201,4 @@ public class JmesPathMatcherTests
|
||||
// Assert
|
||||
score.Should().Be(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -42,7 +41,7 @@ public class JsonMatcherTests
|
||||
var name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("JsonMatcher");
|
||||
name.Should().Be("JsonMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -55,7 +54,7 @@ public class JsonMatcherTests
|
||||
var value = matcher.Value;
|
||||
|
||||
// Assert
|
||||
Check.That(value).Equals("{}");
|
||||
value.Should().Be("{}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -105,7 +104,7 @@ public class JsonMatcherTests
|
||||
var match = matcher.IsMatch(bytes).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -119,7 +118,7 @@ public class JsonMatcherTests
|
||||
var match = matcher.IsMatch(s).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -133,7 +132,7 @@ public class JsonMatcherTests
|
||||
var match = matcher.IsMatch(o).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -524,4 +523,4 @@ public class JsonMatcherTests
|
||||
// Assert
|
||||
Assert.Equal(1.0, score);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -20,7 +19,7 @@ public class JsonPartialMatcherTests
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("JsonPartialMatcher");
|
||||
name.Should().Be("JsonPartialMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -33,7 +32,7 @@ public class JsonPartialMatcherTests
|
||||
object value = matcher.Value;
|
||||
|
||||
// Assert
|
||||
Check.That(value).Equals("{}");
|
||||
value.Should().Be("{}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -83,7 +82,7 @@ public class JsonPartialMatcherTests
|
||||
double match = matcher.IsMatch(bytes).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -97,7 +96,7 @@ public class JsonPartialMatcherTests
|
||||
double match = matcher.IsMatch(s).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -111,7 +110,7 @@ public class JsonPartialMatcherTests
|
||||
double match = matcher.IsMatch(o).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -463,4 +462,4 @@ public class JsonPartialMatcherTests
|
||||
// Assert
|
||||
Assert.Equal(0.0, match);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -20,7 +19,7 @@ public class JsonPartialWildcardMatcherTests
|
||||
var name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("JsonPartialWildcardMatcher");
|
||||
name.Should().Be("JsonPartialWildcardMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -33,7 +32,7 @@ public class JsonPartialWildcardMatcherTests
|
||||
var value = matcher.Value;
|
||||
|
||||
// Assert
|
||||
Check.That(value).Equals("{}");
|
||||
value.Should().Be("{}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -83,7 +82,7 @@ public class JsonPartialWildcardMatcherTests
|
||||
var match = matcher.IsMatch(bytes).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -97,7 +96,7 @@ public class JsonPartialWildcardMatcherTests
|
||||
var match = matcher.IsMatch(s).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -111,7 +110,7 @@ public class JsonPartialWildcardMatcherTests
|
||||
var match = matcher.IsMatch(o).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -417,4 +416,4 @@ public class JsonPartialWildcardMatcherTests
|
||||
// Assert
|
||||
Assert.Equal(1.0, match);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -19,7 +17,7 @@ public class JsonPathMatcherTests
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("JsonPathMatcher");
|
||||
name.Should().Be("JsonPathMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -32,7 +30,7 @@ public class JsonPathMatcherTests
|
||||
var patterns = matcher.GetPatterns();
|
||||
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly("X");
|
||||
patterns.Should().ContainSingle("X");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -46,7 +44,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(bytes).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -59,7 +57,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(null).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -72,7 +70,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(string.Empty).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -86,7 +84,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(o).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -99,7 +97,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch("").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -112,7 +110,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch("x").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -125,7 +123,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(new { Id = 1, Name = "Test" }).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1);
|
||||
match.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -138,7 +136,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(new { things = new { name = "x" } }).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1);
|
||||
match.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -152,7 +150,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(json).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1);
|
||||
match.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -166,7 +164,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(json).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
match.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -185,7 +183,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(jobject).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1);
|
||||
match.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -198,7 +196,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(JObject.Parse("{\"Id\":1,\"Name\":\"Test\"}")).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1);
|
||||
match.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -211,7 +209,7 @@ public class JsonPathMatcherTests
|
||||
double match = matcher.IsMatch(JObject.Parse("{\"Id\":1,\"Name\":\"Test\"}")).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0.0);
|
||||
match.Should().Be(0.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -231,7 +229,7 @@ public class JsonPathMatcherTests
|
||||
}")).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1.0);
|
||||
match.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -253,7 +251,7 @@ public class JsonPathMatcherTests
|
||||
}")).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1.0);
|
||||
match.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -275,7 +273,7 @@ public class JsonPathMatcherTests
|
||||
}")).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0.0);
|
||||
match.Should().Be(0.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -293,7 +291,7 @@ public class JsonPathMatcherTests
|
||||
}")).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0.0);
|
||||
match.Should().Be(0.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -311,7 +309,7 @@ public class JsonPathMatcherTests
|
||||
}")).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0.0);
|
||||
match.Should().Be(0.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -335,7 +333,7 @@ public class JsonPathMatcherTests
|
||||
}")).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(1.0);
|
||||
match.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -385,4 +383,4 @@ public class JsonPathMatcherTests
|
||||
// Assert
|
||||
match.Should().Be(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
using FluentAssertions;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
using Xunit;
|
||||
|
||||
@@ -99,7 +99,7 @@ public class LinqMatcherTests
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("LinqMatcher");
|
||||
name.Should().Be("LinqMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -112,6 +112,6 @@ public class LinqMatcherTests
|
||||
var patterns = matcher.GetPatterns();
|
||||
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly("x");
|
||||
patterns.Should().ContainExactly("x");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -10,16 +9,16 @@ public class MatchBehaviourHelperTests
|
||||
[Fact]
|
||||
public void MatchBehaviourHelper_Convert_AcceptOnMatch()
|
||||
{
|
||||
Check.That(MatchBehaviourHelper.Convert(MatchBehaviour.AcceptOnMatch, 0.0)).IsEqualTo(0.0);
|
||||
Check.That(MatchBehaviourHelper.Convert(MatchBehaviour.AcceptOnMatch, 0.5)).IsEqualTo(0.5);
|
||||
Check.That(MatchBehaviourHelper.Convert(MatchBehaviour.AcceptOnMatch, 1.0)).IsEqualTo(1.0);
|
||||
MatchBehaviourHelper.Convert(MatchBehaviour.AcceptOnMatch, 0.0).Should().Be(0.0);
|
||||
MatchBehaviourHelper.Convert(MatchBehaviour.AcceptOnMatch, 0.5).Should().Be(0.5);
|
||||
MatchBehaviourHelper.Convert(MatchBehaviour.AcceptOnMatch, 1.0).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MatchBehaviourHelper_Convert_RejectOnMatch()
|
||||
{
|
||||
Check.That(MatchBehaviourHelper.Convert(MatchBehaviour.RejectOnMatch, 0.0)).IsEqualTo(1.0);
|
||||
Check.That(MatchBehaviourHelper.Convert(MatchBehaviour.RejectOnMatch, 0.5)).IsEqualTo(0.0);
|
||||
Check.That(MatchBehaviourHelper.Convert(MatchBehaviour.RejectOnMatch, 1.0)).IsEqualTo(0.0);
|
||||
MatchBehaviourHelper.Convert(MatchBehaviour.RejectOnMatch, 0.0).Should().Be(1.0);
|
||||
MatchBehaviourHelper.Convert(MatchBehaviour.RejectOnMatch, 0.5).Should().Be(0.0);
|
||||
MatchBehaviourHelper.Convert(MatchBehaviour.RejectOnMatch, 1.0).Should().Be(0.0);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Util;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.GraphQL.Models;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers.Models;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -16,7 +14,7 @@ public class NotNullOrEmptyMatcherTests
|
||||
var name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("NotNullOrEmptyMatcher");
|
||||
name.Should().Be("NotNullOrEmptyMatcher");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -81,4 +79,4 @@ public class NotNullOrEmptyMatcherTests
|
||||
// Assert
|
||||
patterns.Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using ProtoBuf;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Models;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -18,7 +16,7 @@ public class RegexMatcherTests
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("RegexMatcher");
|
||||
name.Should().Be("RegexMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -31,7 +29,7 @@ public class RegexMatcherTests
|
||||
var patterns = matcher.GetPatterns();
|
||||
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly("X");
|
||||
patterns.Should().ContainSingle("X");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -42,8 +40,8 @@ public class RegexMatcherTests
|
||||
bool case2 = new RegexMatcher("X", true).IgnoreCase;
|
||||
|
||||
// Assert
|
||||
Check.That(case1).IsFalse();
|
||||
Check.That(case2).IsTrue();
|
||||
case1.Should().BeFalse();
|
||||
case2.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -56,7 +54,7 @@ public class RegexMatcherTests
|
||||
double result = matcher.IsMatch("Hello world!").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0d);
|
||||
result.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -69,7 +67,7 @@ public class RegexMatcherTests
|
||||
double result = matcher.IsMatch(null).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(0.0d);
|
||||
result.Should().Be(0.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -108,7 +106,7 @@ public class RegexMatcherTests
|
||||
double result = matcher.IsMatch("hello").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0d);
|
||||
result.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -121,6 +119,6 @@ public class RegexMatcherTests
|
||||
double result = matcher.IsMatch("hello").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(0.0);
|
||||
result.Should().Be(0.0);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Net.Tests.Matchers;
|
||||
@@ -17,7 +17,7 @@ public class SimMetricsMatcherTests
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("SimMetricsMatcher.Levenstein");
|
||||
name.Should().Be("SimMetricsMatcher.Levenstein");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -30,7 +30,7 @@ public class SimMetricsMatcherTests
|
||||
var patterns = matcher.GetPatterns();
|
||||
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly("X");
|
||||
patterns.Should().ContainSingle("X");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -43,7 +43,7 @@ public class SimMetricsMatcherTests
|
||||
double result = matcher.IsMatch("The car drives in the street.").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsStrictlyLessThan(1.0).And.IsStrictlyGreaterThan(0.5);
|
||||
result.Should().BeLessThan(1.0).And.BeGreaterThan(0.5);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -56,7 +56,7 @@ public class SimMetricsMatcherTests
|
||||
double result = matcher.IsMatch("Hello").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsStrictlyLessThan(0.1).And.IsStrictlyGreaterThan(0.05);
|
||||
result.Should().BeLessThan(0.1).And.BeGreaterThan(0.05);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -69,7 +69,7 @@ public class SimMetricsMatcherTests
|
||||
double result = matcher.IsMatch("test").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
result.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -82,6 +82,6 @@ public class SimMetricsMatcherTests
|
||||
double result = matcher.IsMatch("test").Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(0.0);
|
||||
result.Should().Be(0.0);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AnyOfTypes;
|
||||
using AwesomeAssertions;
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Models;
|
||||
|
||||
@@ -123,7 +121,7 @@ public class WildcardMatcherTest
|
||||
var name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("WildcardMatcher");
|
||||
name.Should().Be("WildcardMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -136,7 +134,7 @@ public class WildcardMatcherTest
|
||||
var patterns = matcher.GetPatterns();
|
||||
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly(new AnyOf<string, StringPattern>("x"));
|
||||
patterns.Should().Equal(new[] { new AnyOf<string, StringPattern>("x") });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -148,6 +146,6 @@ public class WildcardMatcherTest
|
||||
// Act
|
||||
var result = matcher.IsMatch("m").Score;
|
||||
|
||||
Check.That(result).IsEqualTo(0.0);
|
||||
result.Should().Be(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
using WireMock.Admin.Mappings;
|
||||
using WireMock.Matchers;
|
||||
|
||||
@@ -18,7 +17,7 @@ public class XPathMatcherTests
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("XPathMatcher");
|
||||
name.Should().Be("XPathMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -31,7 +30,7 @@ public class XPathMatcherTests
|
||||
var patterns = matcher.GetPatterns();
|
||||
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly("X");
|
||||
patterns.Should().ContainSingle("X");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -48,7 +47,7 @@ public class XPathMatcherTests
|
||||
double result = matcher.IsMatch(xml).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
result.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -80,7 +79,7 @@ public class XPathMatcherTests
|
||||
double result = matcher.IsMatch(input).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
result.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -113,7 +112,7 @@ public class XPathMatcherTests
|
||||
double result = matcher.IsMatch(input).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
result.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -130,6 +129,6 @@ public class XPathMatcherTests
|
||||
double result = matcher.IsMatch(xml).Score;
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(0.0);
|
||||
result.Should().Be(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using AwesomeAssertions;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Logging;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -147,9 +146,9 @@ public class ObservableLogEntriesTest
|
||||
var countResponsesWithStatusNotOk = responses.Count(r => r.StatusCode != HttpStatusCode.OK);
|
||||
|
||||
// Assert
|
||||
Check.That(countResponsesWithStatusNotOk).Equals(0);
|
||||
Check.That(count).Equals(expectedCount);
|
||||
countResponsesWithStatusNotOk.Should().Be(0);
|
||||
count.Should().Be(expectedCount);
|
||||
|
||||
server.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Net.OpenApiParser.Utils;
|
||||
|
||||
namespace WireMock.Net.Tests.OpenApiParser;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.OpenTelemetry;
|
||||
|
||||
namespace WireMock.Net.Tests.OpenTelemetry;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Net.WebSockets;
|
||||
using AwesomeAssertions;
|
||||
using Moq;
|
||||
using WireMock.Logging;
|
||||
using WireMock.Matchers.Request;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
using WireMock.Owin;
|
||||
using WireMock.Owin.Mappers;
|
||||
|
||||
@@ -31,6 +30,7 @@ public class GlobalExceptionMiddlewareTests
|
||||
public void GlobalExceptionMiddleware_Invoke_NullAsNext_DoesNotInvokeNextAndDoesNotThrow()
|
||||
{
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.Invoke(null)).DoesNotThrow();
|
||||
Action act = () => _sut.Invoke(null);
|
||||
act.Should().NotThrow();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Owin;
|
||||
using WireMock.Types;
|
||||
|
||||
|
||||
@@ -1,23 +1,14 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using Moq;
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Owin.Mappers;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Types;
|
||||
using WireMock.Util;
|
||||
using WireMock.Owin;
|
||||
#if NET452
|
||||
using Microsoft.Owin;
|
||||
using IResponse = Microsoft.Owin.IOwinResponse;
|
||||
// using Response = Microsoft.Owin.OwinResponse;
|
||||
#else
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using IResponse = Microsoft.AspNetCore.Http.HttpResponse;
|
||||
// using Response = Microsoft.AspNetCore.Http.HttpResponse;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
#endif
|
||||
|
||||
namespace WireMock.Net.Tests.Owin.Mappers;
|
||||
|
||||
@@ -25,7 +16,7 @@ public class OwinResponseMapperTests
|
||||
{
|
||||
private static readonly Task CompletedTask = Task.FromResult(true);
|
||||
private readonly OwinResponseMapper _sut;
|
||||
private readonly Mock<IResponse> _responseMock;
|
||||
private readonly Mock<HttpResponse> _responseMock;
|
||||
private readonly Mock<Stream> _stream;
|
||||
private readonly Mock<IHeaderDictionary> _headers;
|
||||
private readonly Mock<IFileSystemHandler> _fileSystemHandlerMock;
|
||||
@@ -52,7 +43,7 @@ public class OwinResponseMapperTests
|
||||
_headers.Setup(h => h.Add(It.IsAny<string>(), It.IsAny<StringValues>()));
|
||||
#endif
|
||||
|
||||
_responseMock = new Mock<IResponse>();
|
||||
_responseMock = new Mock<HttpResponse>();
|
||||
_responseMock.SetupAllProperties();
|
||||
_responseMock.SetupGet(r => r.Body).Returns(_stream.Object);
|
||||
_responseMock.SetupGet(r => r.Headers).Returns(_headers.Object);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
using AwesomeAssertions;
|
||||
using Moq;
|
||||
using WireMock.Logging;
|
||||
using WireMock.Matchers.Request;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.Linq.Expressions;
|
||||
using AwesomeAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using WireMock.Admin.Mappings;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using WireMock.Matchers;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
|
||||
using WireMock.RegularExpressions;
|
||||
|
||||
namespace WireMock.Net.Tests.RegularExpressions;
|
||||
@@ -23,10 +23,10 @@ public class RegexExtendedTests
|
||||
var regexLower = new RegexExtended(guidbLower);
|
||||
var regexUpper = new RegexExtended(guidbUpper);
|
||||
|
||||
Check.That(regexLower.IsMatch(inputLower)).Equals(true);
|
||||
Check.That(regexLower.IsMatch(inputUpper)).Equals(false);
|
||||
Check.That(regexUpper.IsMatch(inputUpper)).Equals(true);
|
||||
Check.That(regexUpper.IsMatch(inputLower)).Equals(false);
|
||||
regexLower.IsMatch(inputLower).Should().Be(true);
|
||||
regexLower.IsMatch(inputUpper).Should().Be(false);
|
||||
regexUpper.IsMatch(inputUpper).Should().Be(true);
|
||||
regexUpper.IsMatch(inputLower).Should().Be(false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -40,10 +40,10 @@ public class RegexExtendedTests
|
||||
var regexLower = new RegexExtended(guiddLower);
|
||||
var regexUpper = new RegexExtended(guiddUpper);
|
||||
|
||||
Check.That(regexLower.IsMatch(inputLower)).Equals(true);
|
||||
Check.That(regexLower.IsMatch(inputUpper)).Equals(false);
|
||||
Check.That(regexUpper.IsMatch(inputUpper)).Equals(true);
|
||||
Check.That(regexUpper.IsMatch(inputLower)).Equals(false);
|
||||
regexLower.IsMatch(inputLower).Should().Be(true);
|
||||
regexLower.IsMatch(inputUpper).Should().Be(false);
|
||||
regexUpper.IsMatch(inputUpper).Should().Be(true);
|
||||
regexUpper.IsMatch(inputLower).Should().Be(false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -57,10 +57,10 @@ public class RegexExtendedTests
|
||||
var regexLower = new RegexExtended(guidnLower);
|
||||
var regexUpper = new RegexExtended(guidnUpper);
|
||||
|
||||
Check.That(regexLower.IsMatch(inputLower)).Equals(true);
|
||||
Check.That(regexLower.IsMatch(inputUpper)).Equals(false);
|
||||
Check.That(regexUpper.IsMatch(inputUpper)).Equals(true);
|
||||
Check.That(regexUpper.IsMatch(inputLower)).Equals(false);
|
||||
regexLower.IsMatch(inputLower).Should().Be(true);
|
||||
regexLower.IsMatch(inputUpper).Should().Be(false);
|
||||
regexUpper.IsMatch(inputUpper).Should().Be(true);
|
||||
regexUpper.IsMatch(inputLower).Should().Be(false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -74,10 +74,10 @@ public class RegexExtendedTests
|
||||
var regexLower = new RegexExtended(guidpLower);
|
||||
var regexUpper = new RegexExtended(guidpUpper);
|
||||
|
||||
Check.That(regexLower.IsMatch(inputLower)).Equals(true);
|
||||
Check.That(regexLower.IsMatch(inputUpper)).Equals(false);
|
||||
Check.That(regexUpper.IsMatch(inputUpper)).Equals(true);
|
||||
Check.That(regexUpper.IsMatch(inputLower)).Equals(false);
|
||||
regexLower.IsMatch(inputLower).Should().Be(true);
|
||||
regexLower.IsMatch(inputUpper).Should().Be(false);
|
||||
regexUpper.IsMatch(inputUpper).Should().Be(true);
|
||||
regexUpper.IsMatch(inputLower).Should().Be(false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -91,9 +91,9 @@ public class RegexExtendedTests
|
||||
var regexLower = new RegexExtended(guidxLower);
|
||||
var regexUpper = new RegexExtended(guidxUpper);
|
||||
|
||||
Check.That(regexLower.IsMatch(inputLower)).Equals(true);
|
||||
Check.That(regexLower.IsMatch(inputUpper)).Equals(false);
|
||||
Check.That(regexUpper.IsMatch(inputUpper)).Equals(true);
|
||||
Check.That(regexUpper.IsMatch(inputLower)).Equals(false);
|
||||
regexLower.IsMatch(inputLower).Should().Be(true);
|
||||
regexLower.IsMatch(inputUpper).Should().Be(false);
|
||||
regexUpper.IsMatch(inputUpper).Should().Be(true);
|
||||
regexUpper.IsMatch(inputLower).Should().Be(false);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
using WireMock.Owin;
|
||||
@@ -25,7 +25,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsNotEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().NotBe(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -44,7 +44,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsNotEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().NotBe(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -63,7 +63,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsNotEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().NotBe(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -82,7 +82,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -101,7 +101,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -120,7 +120,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(0.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(0.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -139,7 +139,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -158,7 +158,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(0.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(0.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -177,7 +177,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -196,7 +196,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsNotEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().NotBe(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -210,7 +210,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -228,7 +228,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -242,7 +242,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -256,6 +256,7 @@ public class RequestBuilderTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsNotEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().NotBe(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.RequestBuilders;
|
||||
|
||||
@@ -16,8 +16,8 @@ public class RequestBuilderUsingMethodTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That((matchers[0] as RequestMessageMethodMatcher).Methods).ContainsExactly("CONNECT");
|
||||
matchers.Count.Should().Be(1);
|
||||
((matchers[0] as RequestMessageMethodMatcher).Methods).Should().ContainSingle("CONNECT");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -28,8 +28,8 @@ public class RequestBuilderUsingMethodTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That((matchers[0] as RequestMessageMethodMatcher).Methods).ContainsExactly("OPTIONS");
|
||||
matchers.Count.Should().Be(1);
|
||||
((matchers[0] as RequestMessageMethodMatcher).Methods).Should().ContainSingle("OPTIONS");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -40,8 +40,8 @@ public class RequestBuilderUsingMethodTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That((matchers[0] as RequestMessageMethodMatcher).Methods).ContainsExactly("PATCH");
|
||||
matchers.Count.Should().Be(1);
|
||||
((matchers[0] as RequestMessageMethodMatcher).Methods).Should().ContainSingle("PATCH");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -52,8 +52,8 @@ public class RequestBuilderUsingMethodTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That((matchers[0] as RequestMessageMethodMatcher).Methods).ContainsExactly("TRACE");
|
||||
matchers.Count.Should().Be(1);
|
||||
((matchers[0] as RequestMessageMethodMatcher).Methods).Should().ContainSingle("TRACE");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -64,14 +64,14 @@ public class RequestBuilderUsingMethodTests
|
||||
|
||||
// Assert 1
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageMethodMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageMethodMatcher>();
|
||||
|
||||
// Act
|
||||
requestBuilder.UsingAnyMethod();
|
||||
|
||||
// Assert 2
|
||||
matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(0);
|
||||
matchers.Count.Should().Be(0);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
@@ -65,7 +64,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -86,7 +85,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -109,7 +108,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request, requestMatchResult)).IsEqualTo(expected);
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -130,7 +129,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request, requestMatchResult)).IsEqualTo(0.0);
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(0.0);
|
||||
}
|
||||
|
||||
private class FuncType
|
||||
@@ -157,7 +156,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -176,7 +175,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -195,7 +194,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -214,7 +213,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -277,7 +276,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -301,7 +300,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsNotEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().NotBe(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -320,7 +319,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -339,7 +338,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsNotEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().NotBe(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -362,7 +361,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -385,7 +384,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -409,7 +408,7 @@ public class RequestBuilderWithBodyTests
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
double result = spec.GetMatchingScore(request, requestMatchResult);
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
result.Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -430,7 +429,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -454,7 +453,7 @@ public class RequestBuilderWithBodyTests
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -480,4 +479,5 @@ public class RequestBuilderWithBodyTests
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
requestBuilder.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
@@ -21,7 +20,7 @@ public class RequestBuilderWithClientIPTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -35,7 +34,7 @@ public class RequestBuilderWithClientIPTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(0.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(0.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -49,7 +48,7 @@ public class RequestBuilderWithClientIPTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -63,6 +62,6 @@ public class RequestBuilderWithClientIPTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.RequestBuilders;
|
||||
@@ -17,8 +16,8 @@ public class RequestBuilderWithCookieTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageCookieMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageCookieMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -29,8 +28,8 @@ public class RequestBuilderWithCookieTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageCookieMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageCookieMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -41,7 +40,7 @@ public class RequestBuilderWithCookieTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageCookieMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageCookieMatcher>();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using GraphQL.Types;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.RequestBuilders;
|
||||
@@ -17,8 +17,8 @@ public class RequestBuilderWithHeaderTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageHeaderMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageHeaderMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -29,8 +29,8 @@ public class RequestBuilderWithHeaderTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageHeaderMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageHeaderMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -41,8 +41,8 @@ public class RequestBuilderWithHeaderTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageHeaderMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageHeaderMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -53,8 +53,8 @@ public class RequestBuilderWithHeaderTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageHeaderMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageHeaderMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -65,8 +65,8 @@ public class RequestBuilderWithHeaderTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageHeaderMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageHeaderMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -77,7 +77,7 @@ public class RequestBuilderWithHeaderTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageHeaderMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageHeaderMatcher>();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.RequestBuilders;
|
||||
@@ -17,8 +16,8 @@ public class RequestBuilderWithParamTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageParamMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageParamMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -29,8 +28,8 @@ public class RequestBuilderWithParamTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageParamMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageParamMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -41,8 +40,8 @@ public class RequestBuilderWithParamTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageParamMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageParamMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -53,7 +52,7 @@ public class RequestBuilderWithParamTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageParamMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageParamMatcher>();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.Matchers.Request;
|
||||
@@ -25,7 +25,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -43,7 +43,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -57,7 +57,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -69,8 +69,8 @@ public class RequestBuilderWithPathTests
|
||||
var request2 = new RequestMessage(new UrlDetails("http://localhost/x2"), "blabla", ClientIp);
|
||||
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(requestBuilder.GetMatchingScore(request1, requestMatchResult)).IsEqualTo(1.0);
|
||||
Check.That(requestBuilder.GetMatchingScore(request2, requestMatchResult)).IsEqualTo(1.0);
|
||||
requestBuilder.GetMatchingScore(request1, requestMatchResult).Should().Be(1.0);
|
||||
requestBuilder.GetMatchingScore(request2, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -84,7 +84,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -98,7 +98,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -112,7 +112,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsNotEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().NotBe(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -131,7 +131,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -149,7 +149,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -163,7 +163,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -177,7 +177,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -191,7 +191,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -205,7 +205,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -219,7 +219,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -233,6 +233,7 @@ public class RequestBuilderWithPathTests
|
||||
|
||||
// then
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
Check.That(spec.GetMatchingScore(request, requestMatchResult)).IsNotEqualTo(1.0);
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().NotBe(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.RequestBuilders;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.RequestBuilders;
|
||||
@@ -17,8 +16,8 @@ public class RequestBuilderWithUrlTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageUrlMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageUrlMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -29,8 +28,8 @@ public class RequestBuilderWithUrlTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageUrlMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageUrlMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -41,8 +40,8 @@ public class RequestBuilderWithUrlTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageUrlMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageUrlMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -53,7 +52,7 @@ public class RequestBuilderWithUrlTests
|
||||
|
||||
// Assert
|
||||
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
|
||||
Check.That(matchers.Count).IsEqualTo(1);
|
||||
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageUrlMatcher));
|
||||
matchers.Count.Should().Be(1);
|
||||
matchers[0].Should().BeOfType<RequestMessageUrlMatcher>();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
@@ -35,7 +34,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1d);
|
||||
score.Should().Be(1d);
|
||||
|
||||
// Verify
|
||||
stringMatcherMock.Verify(m => m.GetPatterns(), Times.Never);
|
||||
@@ -72,7 +71,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(expected);
|
||||
score.Should().Be(expected);
|
||||
|
||||
// Verify
|
||||
stringMatcherMock1.Verify(m => m.GetPatterns(), Times.Never);
|
||||
@@ -113,7 +112,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(expected);
|
||||
score.Should().Be(expected);
|
||||
|
||||
// Verify
|
||||
stringMatcherMock1.Verify(m => m.GetPatterns(), Times.Never);
|
||||
@@ -154,7 +153,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(expected);
|
||||
score.Should().Be(expected);
|
||||
|
||||
// Verify
|
||||
stringMatcherMock1.Verify(m => m.GetPatterns(), Times.Never);
|
||||
@@ -185,7 +184,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.0d);
|
||||
score.Should().Be(0.0d);
|
||||
|
||||
// Verify
|
||||
stringMatcherMock.Verify(m => m.GetPatterns(), Times.Never);
|
||||
@@ -213,7 +212,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
|
||||
// Verify
|
||||
stringMatcherMock.Verify(m => m.IsMatch(It.IsAny<string>()), Times.Once);
|
||||
@@ -242,7 +241,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1d);
|
||||
score.Should().Be(1d);
|
||||
|
||||
// Verify
|
||||
stringMatcherMock.Verify(m => m.IsMatch(It.IsAny<string>()), Times.Once);
|
||||
@@ -269,7 +268,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1d);
|
||||
score.Should().Be(1d);
|
||||
|
||||
// Verify
|
||||
objectMatcherMock.Verify(m => m.IsMatch(42), Times.Once);
|
||||
@@ -294,7 +293,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -393,7 +392,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
|
||||
// Verify
|
||||
objectMatcherMock.Verify(m => m.IsMatch(It.IsAny<byte[]>()), Times.Once);
|
||||
@@ -421,7 +420,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -445,7 +444,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -469,7 +468,7 @@ public class RequestMessageBodyMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -510,7 +509,7 @@ public class RequestMessageBodyMatcherTests
|
||||
var score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// assert
|
||||
Check.That(score).IsEqualTo(shouldMatch ? 1d : 0d);
|
||||
score.Should().Be(shouldMatch ? 1d : 0d);
|
||||
}
|
||||
|
||||
public static TheoryData<object, RequestMessageBodyMatcher, bool> MatchingScoreData
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using Moq;
|
||||
using NFluent;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
|
||||
@@ -28,7 +27,7 @@ public class RequestMessageCompositeMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.0d);
|
||||
score.Should().Be(0.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -48,7 +47,7 @@ public class RequestMessageCompositeMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.9d);
|
||||
score.Should().Be(0.9d);
|
||||
|
||||
// Verify
|
||||
requestMatcher1Mock.Verify(rm => rm.GetMatchingScore(It.IsAny<RequestMessage>(), It.IsAny<RequestMatchResult>()), Times.Once);
|
||||
@@ -72,7 +71,7 @@ public class RequestMessageCompositeMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
|
||||
// Verify
|
||||
requestMatcher1Mock.Verify(rm => rm.GetMatchingScore(It.IsAny<RequestMessage>(), It.IsAny<RequestMatchResult>()), Times.Once);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
@@ -21,7 +20,7 @@ public class RequestMessageCookieMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.0d);
|
||||
score.Should().Be(0.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -36,7 +35,7 @@ public class RequestMessageCookieMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -52,7 +51,7 @@ public class RequestMessageCookieMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -68,7 +67,7 @@ public class RequestMessageCookieMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.0d);
|
||||
score.Should().Be(0.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -84,7 +83,7 @@ public class RequestMessageCookieMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -100,7 +99,7 @@ public class RequestMessageCookieMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -116,7 +115,7 @@ public class RequestMessageCookieMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -132,7 +131,7 @@ public class RequestMessageCookieMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -148,6 +147,6 @@ public class RequestMessageCookieMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Moq;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
@@ -21,7 +20,7 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.0d);
|
||||
score.Should().Be(0.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -36,7 +35,7 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -52,7 +51,7 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.0d);
|
||||
score.Should().Be(0.0d);
|
||||
}
|
||||
[Fact]
|
||||
public void RequestMessageHeaderMatcher_GetMatchingScore_RejectOnMatch_HeaderDoesNotMatchPattern()
|
||||
@@ -67,7 +66,7 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -83,7 +82,7 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -99,7 +98,7 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.0d);
|
||||
score.Should().Be(0.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -115,7 +114,7 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.0d);
|
||||
score.Should().Be(0.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -131,7 +130,7 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -147,7 +146,7 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -163,7 +162,7 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -179,6 +178,6 @@ public class RequestMessageHeaderMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
@@ -24,7 +22,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -39,7 +37,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.5d);
|
||||
score.Should().Be(0.5d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -54,7 +52,7 @@ public class RequestMessageParamMatcherTests
|
||||
var score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -69,7 +67,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsCloseTo(0.66d, 0.1d);
|
||||
score.Should().BeApproximately(0.66d, 0.1d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -84,7 +82,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsCloseTo(0.66d, 0.1d);
|
||||
score.Should().BeApproximately(0.66d, 0.1d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -99,7 +97,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -114,7 +112,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -129,7 +127,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.5d);
|
||||
score.Should().Be(0.5d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -144,7 +142,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(0.0d);
|
||||
score.Should().Be(0.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -159,7 +157,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -174,7 +172,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -189,7 +187,7 @@ public class RequestMessageParamMatcherTests
|
||||
double score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
score.Should().Be(1.0d);
|
||||
}
|
||||
|
||||
// Issue #849
|
||||
@@ -211,4 +209,5 @@ public class RequestMessageParamMatcherTests
|
||||
// Assert
|
||||
score.Should().Be(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using NFluent;
|
||||
using WireMock.Models;
|
||||
using WireMock.Util;
|
||||
|
||||
namespace WireMock.Net.Tests;
|
||||
|
||||
@@ -17,7 +15,7 @@ public class RequestMessageTests
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "posT", ClientIp);
|
||||
|
||||
// then
|
||||
Check.That(request.Method).IsEqualTo("posT");
|
||||
request.Method.Should().Be("posT");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -27,7 +25,7 @@ public class RequestMessageTests
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "POST", ClientIp);
|
||||
|
||||
// then
|
||||
Check.That(request.GetParameter("not_there")).IsNull();
|
||||
request.GetParameter("not_there").Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -37,7 +35,7 @@ public class RequestMessageTests
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost?foo=bar"), "POST", ClientIp);
|
||||
|
||||
// Assert
|
||||
Check.That(request.GetParameter("foo")).ContainsExactly("bar");
|
||||
request.GetParameter("foo").Should().ContainSingle("bar");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -47,7 +45,7 @@ public class RequestMessageTests
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost?foo=bar"), "POST", ClientIp);
|
||||
|
||||
// Assert
|
||||
Check.That(request.GetParameter("FoO", true)).ContainsExactly("bar");
|
||||
request.GetParameter("FoO", true).Should().ContainSingle("bar");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -57,8 +55,8 @@ public class RequestMessageTests
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost?key=1&key=2"), "POST", ClientIp);
|
||||
|
||||
// Assert
|
||||
Check.That(request.GetParameter("key")).Contains("1");
|
||||
Check.That(request.GetParameter("key")).Contains("2");
|
||||
request.GetParameter("key").Should().Contain("1");
|
||||
request.GetParameter("key").Should().Contain("2");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -68,9 +66,9 @@ public class RequestMessageTests
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost?key=1,2,3"), "POST", ClientIp);
|
||||
|
||||
// Assert
|
||||
Check.That(request.GetParameter("key")).Contains("1");
|
||||
Check.That(request.GetParameter("key")).Contains("2");
|
||||
Check.That(request.GetParameter("key")).Contains("3");
|
||||
request.GetParameter("key").Should().Contain("1");
|
||||
request.GetParameter("key").Should().Contain("2");
|
||||
request.GetParameter("key").Should().Contain("3");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -80,28 +78,8 @@ public class RequestMessageTests
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost?key=1,2&foo=bar&key=3"), "POST", ClientIp);
|
||||
|
||||
// Assert
|
||||
Check.That(request.GetParameter("key")).Contains("1");
|
||||
Check.That(request.GetParameter("key")).Contains("2");
|
||||
Check.That(request.GetParameter("key")).Contains("3");
|
||||
request.GetParameter("key").Should().Contain("1");
|
||||
request.GetParameter("key").Should().Contain("2");
|
||||
request.GetParameter("key").Should().Contain("3");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RequestMessage_Constructor1_PathSegments()
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost/a/b/c"), "POST", ClientIp);
|
||||
|
||||
// Assert
|
||||
Check.That(request.PathSegments).ContainsExactly("a", "b", "c");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RequestMessage_Constructor2_PathSegments()
|
||||
{
|
||||
// Assign
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost/a/b/c"), "POST", ClientIp, new BodyData());
|
||||
|
||||
// Assert
|
||||
Check.That(request.PathSegments).ContainsExactly("a", "b", "c");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Settings;
|
||||
@@ -27,6 +27,6 @@ public class ResponseCreateTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(mapping, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message).Equals(responseMessage);
|
||||
response.Message.Should().Be(responseMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using AwesomeAssertions;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Server;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using JsonConverter.Newtonsoft.Json;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -45,15 +44,15 @@ public class ResponseWithBodyTests
|
||||
};
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "POST", ClientIp, body);
|
||||
|
||||
var responseBuilder = Response.Create().WithBody(new byte[] { 48, 49 }, BodyDestinationFormat.String, Encoding.ASCII);
|
||||
var responseBuilder = Response.Create().WithBody([48, 49], BodyDestinationFormat.String, Encoding.ASCII);
|
||||
|
||||
// act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// then
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("01");
|
||||
Check.That(response.Message.BodyData.BodyAsBytes).IsNull();
|
||||
Check.That(response.Message.BodyData.Encoding).Equals(Encoding.ASCII);
|
||||
response.Message.BodyData.BodyAsString.Should().Be("01");
|
||||
response.Message.BodyData.BodyAsBytes.Should().BeNull();
|
||||
response.Message.BodyData.Encoding.Should().Be(Encoding.ASCII);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -67,15 +66,15 @@ public class ResponseWithBodyTests
|
||||
};
|
||||
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "POST", ClientIp, body);
|
||||
|
||||
var responseBuilder = Response.Create().WithBody(new byte[] { 48, 49 }, BodyDestinationFormat.SameAsSource, Encoding.ASCII);
|
||||
var responseBuilder = Response.Create().WithBody([48, 49], BodyDestinationFormat.SameAsSource, Encoding.ASCII);
|
||||
|
||||
// act
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// then
|
||||
Check.That(response.Message.BodyData.BodyAsBytes).ContainsExactly(new byte[] { 48, 49 });
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsNull();
|
||||
Check.That(response.Message.BodyData.Encoding).IsNull();
|
||||
response.Message.BodyData.BodyAsBytes.Should().ContainInOrder([48, 49]);
|
||||
response.Message.BodyData.BodyAsString.Should().BeNull();
|
||||
response.Message.BodyData.Encoding.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -95,8 +94,8 @@ public class ResponseWithBodyTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// then
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.BodyData.Encoding).Equals(Encoding.ASCII);
|
||||
response.Message.BodyData.BodyAsString.Should().Be("test");
|
||||
response.Message.BodyData.Encoding.Should().Be(Encoding.ASCII);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -117,8 +116,8 @@ public class ResponseWithBodyTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// then
|
||||
Check.That(response.Message.BodyData.BodyAsJson).Equals(x);
|
||||
Check.That(response.Message.BodyData.Encoding).Equals(Encoding.ASCII);
|
||||
response.Message.BodyData.BodyAsJson.Should().Be(x);
|
||||
response.Message.BodyData.Encoding.Should().Be(Encoding.ASCII);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -133,10 +132,10 @@ public class ResponseWithBodyTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsBytes).IsNull();
|
||||
Check.That(response.Message.BodyData.BodyAsJson).IsNull();
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("r");
|
||||
Check.That(response.Message.BodyData.Encoding).Equals(Encoding.ASCII);
|
||||
response.Message.BodyData.BodyAsBytes.Should().BeNull();
|
||||
response.Message.BodyData.BodyAsJson.Should().BeNull();
|
||||
response.Message.BodyData.BodyAsString.Should().Be("r");
|
||||
response.Message.BodyData.Encoding.Should().Be(Encoding.ASCII);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -151,10 +150,10 @@ public class ResponseWithBodyTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsNull();
|
||||
Check.That(response.Message.BodyData.BodyAsJson).IsNull();
|
||||
Check.That(response.Message.BodyData.BodyAsBytes).IsNotNull();
|
||||
Check.That(response.Message.BodyData.Encoding).Equals(Encoding.ASCII);
|
||||
response.Message.BodyData.BodyAsString.Should().BeNull();
|
||||
response.Message.BodyData.BodyAsJson.Should().BeNull();
|
||||
response.Message.BodyData.BodyAsBytes.Should().NotBeNull();
|
||||
response.Message.BodyData.Encoding.Should().Be(Encoding.ASCII);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -169,10 +168,10 @@ public class ResponseWithBodyTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsNull();
|
||||
Check.That(response.Message.BodyData.BodyAsBytes).IsNull();
|
||||
Check.That(((dynamic)response.Message.BodyData.BodyAsJson).value).Equals(42);
|
||||
Check.That(response.Message.BodyData.Encoding).Equals(Encoding.ASCII);
|
||||
response.Message.BodyData!.BodyAsString.Should().BeNull();
|
||||
response.Message.BodyData.BodyAsBytes.Should().BeNull();
|
||||
((int)((JObject)response.Message.BodyData.BodyAsJson)["value"]!).Should().Be(42);
|
||||
response.Message.BodyData.Encoding.Should().Be(Encoding.ASCII);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -193,8 +192,8 @@ public class ResponseWithBodyTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// then
|
||||
Check.That(response.Message.BodyData.BodyAsJson).Equals(x);
|
||||
Check.That(response.Message.BodyData.BodyAsJsonIndented).IsEqualTo(true);
|
||||
response.Message.BodyData.BodyAsJson.Should().Be(x);
|
||||
response.Message.BodyData.BodyAsJsonIndented.Should().Be(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -259,15 +258,15 @@ public class ResponseWithBodyTests
|
||||
var response2 = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request2, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(((JToken)response1.Message.BodyData.BodyAsJson).SelectToken("id")?.Value<int>()).IsEqualTo(request1Id);
|
||||
Check.That(response1.Message.BodyData.BodyAsBytes).IsNull();
|
||||
Check.That(response1.Message.BodyData.BodyAsString).IsNull();
|
||||
Check.That(response1.Message.StatusCode).IsEqualTo(200);
|
||||
((JToken)response1.Message.BodyData.BodyAsJson).SelectToken("id")?.Value<int>().Should().Be(request1Id);
|
||||
response1.Message.BodyData.BodyAsBytes.Should().BeNull();
|
||||
response1.Message.BodyData.BodyAsString.Should().BeNull();
|
||||
response1.Message.StatusCode.Should().Be(200);
|
||||
|
||||
Check.That(((JToken)response2.Message.BodyData.BodyAsJson).SelectToken("id")?.Value<int>()).IsEqualTo(request2Id);
|
||||
Check.That(response2.Message.BodyData.BodyAsBytes).IsNull();
|
||||
Check.That(response2.Message.BodyData.BodyAsString).IsNull();
|
||||
Check.That(response2.Message.StatusCode).IsEqualTo(200);
|
||||
((JToken)response2.Message.BodyData.BodyAsJson).SelectToken("id")?.Value<int>().Should().Be(request2Id);
|
||||
response2.Message.BodyData.BodyAsBytes.Should().BeNull();
|
||||
response2.Message.BodyData.BodyAsString.Should().BeNull();
|
||||
response2.Message.StatusCode.Should().Be(200);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -282,8 +281,8 @@ public class ResponseWithBodyTests
|
||||
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request1, _settings);
|
||||
|
||||
Check.That(response.Message.StatusCode).IsEqualTo(200);
|
||||
Check.That(response.Message.BodyData.BodyAsString).Contains(fileContents);
|
||||
response.Message.StatusCode.Should().Be(200);
|
||||
response.Message.BodyData.BodyAsString.Should().Contain(fileContents);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -298,8 +297,8 @@ public class ResponseWithBodyTests
|
||||
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request1, _settings);
|
||||
|
||||
Check.That(response.Message.StatusCode).IsEqualTo(200);
|
||||
Check.That(response.Message.BodyData.BodyAsString).Contains(fileContents);
|
||||
response.Message.StatusCode.Should().Be(200);
|
||||
response.Message.BodyData.BodyAsString.Should().Contain(fileContents);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -314,8 +313,8 @@ public class ResponseWithBodyTests
|
||||
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request1, _settings);
|
||||
|
||||
Check.That(response.Message.StatusCode).IsEqualTo(200);
|
||||
Check.That(response.Message.BodyData?.BodyAsString).Contains("File deleted.");
|
||||
response.Message.StatusCode.Should().Be(200);
|
||||
response.Message.BodyData?.BodyAsString.Should().Contain("File deleted.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -338,7 +337,6 @@ public class ResponseWithBodyTests
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("""{"foo":"< > & ' 😀 👍 ❤️","n":42}""");
|
||||
}
|
||||
|
||||
#if !(NET451 || NET452 || NET461)
|
||||
[Fact]
|
||||
public async Task Response_ProvideResponse_WithBody_SystemTextJsonConverter()
|
||||
{
|
||||
@@ -358,5 +356,4 @@ public class ResponseWithBodyTests
|
||||
// Assert
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("""{"foo":"\u003C \u003E \u0026 \u0027 \uD83D\uDE00 \uD83D\uDC4D \u2764\uFE0F","n":42}""");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -48,13 +47,13 @@ public class ResponseWithCallbackTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsEqualTo("path: /test");
|
||||
Check.That(response.Message.BodyData.BodyAsBytes).IsNull();
|
||||
Check.That(response.Message.BodyData.BodyAsJson).IsNull();
|
||||
Check.That(response.Message.BodyData.Encoding.CodePage).Equals(Encoding.UTF8.CodePage);
|
||||
Check.That(response.Message.StatusCode).IsEqualTo(500);
|
||||
Check.That(response.Message.Headers["H1"].ToString()).IsEqualTo("X1");
|
||||
Check.That(response.Message.Headers["H2"].ToString()).IsEqualTo("X2");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("path: /test");
|
||||
response.Message.BodyData.BodyAsBytes.Should().BeNull();
|
||||
response.Message.BodyData.BodyAsJson.Should().BeNull();
|
||||
response.Message.BodyData.Encoding.CodePage.Should().Be(Encoding.UTF8.CodePage);
|
||||
response.Message.StatusCode.Should().Be(500);
|
||||
response.Message.Headers["H1"].ToString().Should().Be("X1");
|
||||
response.Message.Headers["H2"].ToString().Should().Be("X2");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -131,13 +130,13 @@ public class ResponseWithCallbackTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsEqualTo("path: /test");
|
||||
Check.That(response.Message.BodyData.BodyAsBytes).IsNull();
|
||||
Check.That(response.Message.BodyData.BodyAsJson).IsNull();
|
||||
Check.That(response.Message.BodyData.Encoding.CodePage).Equals(Encoding.UTF8.CodePage);
|
||||
Check.That(response.Message.StatusCode).IsEqualTo(500);
|
||||
Check.That(response.Message.Headers["H1"].ToString()).IsEqualTo("X1");
|
||||
Check.That(response.Message.Headers["H2"].ToString()).IsEqualTo("X2");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("path: /test");
|
||||
response.Message.BodyData.BodyAsBytes.Should().BeNull();
|
||||
response.Message.BodyData.BodyAsJson.Should().BeNull();
|
||||
response.Message.BodyData.Encoding.CodePage.Should().Be(Encoding.UTF8.CodePage);
|
||||
response.Message.StatusCode.Should().Be(500);
|
||||
response.Message.Headers["H1"].ToString().Should().Be("X1");
|
||||
response.Message.Headers["H2"].ToString().Should().Be("X2");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -313,4 +312,5 @@ public class ResponseWithCallbackTests
|
||||
// Assert
|
||||
response.Message.Headers![headerKey].Should().Contain("extra");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using WireMock.Models;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using HandlebarsDotNet;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -57,7 +55,7 @@ public class ResponseWithHandlebarsFileTests
|
||||
|
||||
// Assert
|
||||
var j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
Check.That(j["Data"].Value<string>()).Equals("abc");
|
||||
j["Data"].Value<string>().Should().Be("abc");
|
||||
|
||||
// Verify
|
||||
_filesystemHandlerMock.Verify(fs => fs.ReadResponseBodyAsString("x.json"), Times.Once);
|
||||
@@ -82,7 +80,7 @@ public class ResponseWithHandlebarsFileTests
|
||||
|
||||
// Assert
|
||||
var j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
Check.That(j["Data"].Value<string>()).Equals("abc");
|
||||
j["Data"].Value<string>().Should().Be("abc");
|
||||
|
||||
// Verify
|
||||
_filesystemHandlerMock.Verify(fs => fs.ReadResponseBodyAsString("x.json"), Times.Once);
|
||||
@@ -103,7 +101,8 @@ public class ResponseWithHandlebarsFileTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings)).Throws<HandlebarsException>();
|
||||
Func<Task> act = () => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
act.Should().ThrowAsync<HandlebarsException>();
|
||||
|
||||
// Verify
|
||||
_filesystemHandlerMock.Verify(fs => fs.ReadResponseBodyAsString(It.IsAny<string>()), Times.Never);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -42,6 +42,6 @@ public class ResponseWithHandlebarsHelpersTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(Mock.Of<IMapping>(), Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("ABC");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("ABC");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -46,6 +46,7 @@ public class ResponseWithHandlebarsHumanizerTests
|
||||
|
||||
// Assert
|
||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
Check.That(j["Text"].Value<string>()).IsEqualTo("Pascal case input string is turned into sentence");
|
||||
j["Text"].Value<string>().Should().Be("Pascal case input string is turned into sentence");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using HandlebarsDotNet;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -84,8 +84,8 @@ public class ResponseWithHandlebarsJsonPathTests
|
||||
|
||||
// Assert
|
||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
Check.That(j["x"]).IsNotNull();
|
||||
Check.That(j["x"]["Name"].ToString()).Equals("Acme Co");
|
||||
j["x"].Should().NotBeNull();
|
||||
j["x"]["Name"].ToString().Should().Be("Acme Co");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -110,7 +110,7 @@ public class ResponseWithHandlebarsJsonPathTests
|
||||
|
||||
// Assert
|
||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson!);
|
||||
Check.That(j["x"].Value<long>()).Equals(99);
|
||||
j["x"].Value<long>().Should().Be(99);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -163,7 +163,7 @@ public class ResponseWithHandlebarsJsonPathTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals($"{{{Environment.NewLine} \"Name\": \"Acme Co\",{Environment.NewLine} \"Products\": [{Environment.NewLine} {{{Environment.NewLine} \"Name\": \"Anvil\",{Environment.NewLine} \"Price\": 50{Environment.NewLine} }}{Environment.NewLine} ]{Environment.NewLine}}}");
|
||||
response.Message.BodyData.BodyAsString.Should().Be($"{{{Environment.NewLine} \"Name\": \"Acme Co\",{Environment.NewLine} \"Products\": [{Environment.NewLine} {{{Environment.NewLine} \"Name\": \"Anvil\",{Environment.NewLine} \"Price\": 50{Environment.NewLine} }}{Environment.NewLine} ]{Environment.NewLine}}}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -216,7 +216,7 @@ public class ResponseWithHandlebarsJsonPathTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals($"{{{Environment.NewLine} \"Name\": \"Acme Co\",{Environment.NewLine} \"Products\": [{Environment.NewLine} {{{Environment.NewLine} \"Name\": \"Anvil\",{Environment.NewLine} \"Price\": 50{Environment.NewLine} }}{Environment.NewLine} ]{Environment.NewLine}}}");
|
||||
response.Message.BodyData.BodyAsString.Should().Be($"{{{Environment.NewLine} \"Name\": \"Acme Co\",{Environment.NewLine} \"Products\": [{Environment.NewLine} {{{Environment.NewLine} \"Name\": \"Anvil\",{Environment.NewLine} \"Price\": 50{Environment.NewLine} }}{Environment.NewLine} ]{Environment.NewLine}}}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -269,7 +269,7 @@ public class ResponseWithHandlebarsJsonPathTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("%0:Anvil%%1:Elbow Grease%");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("%0:Anvil%%1:Elbow Grease%");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -322,7 +322,7 @@ public class ResponseWithHandlebarsJsonPathTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("%0:Anvil%%1:Elbow Grease%");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("%0:Anvil%%1:Elbow Grease%");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -348,7 +348,8 @@ public class ResponseWithHandlebarsJsonPathTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings)).Throws<ArgumentNullException>();
|
||||
Func<Task> act = () => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
act.Should().ThrowAsync<HandlebarsException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using HandlebarsDotNet;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -49,8 +47,8 @@ public class ResponseWithHandlebarsLinqTests
|
||||
|
||||
// Assert
|
||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
Check.That(j["x"]).IsNotNull();
|
||||
Check.That(j["x"].ToString()).Equals("/pathtest");
|
||||
j["x"].Should().NotBeNull();
|
||||
j["x"].ToString().Should().Be("/pathtest");
|
||||
}
|
||||
|
||||
[Fact(Skip = "DynamicLinq")]
|
||||
@@ -79,8 +77,8 @@ public class ResponseWithHandlebarsLinqTests
|
||||
|
||||
// Assert
|
||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
Check.That(j["x"]).IsNotNull();
|
||||
Check.That(j["x"].ToString()).Equals("Test_123");
|
||||
j["x"].Should().NotBeNull();
|
||||
j["x"].ToString().Should().Be("Test_123");
|
||||
}
|
||||
|
||||
[Fact(Skip = "DynamicLinq")]
|
||||
@@ -158,7 +156,10 @@ public class ResponseWithHandlebarsLinqTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings)).Throws<ArgumentException>();
|
||||
Func<Task> act = () => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
act.Should().ThrowAsync<HandlebarsException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -174,7 +175,10 @@ public class ResponseWithHandlebarsLinqTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings)).Throws<HandlebarsException>();
|
||||
Func<Task> act = () => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
act.Should().ThrowAsync<HandlebarsException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -225,9 +229,9 @@ public class ResponseWithHandlebarsLinqTests
|
||||
.WithTransformer();
|
||||
|
||||
// Act
|
||||
Func<Task> a = async () => await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
Func<Task> act = async () => await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
a.Should().ThrowAsync<HandlebarsException>();
|
||||
act.Should().ThrowAsync<HandlebarsException>();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using HandlebarsDotNet;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -45,7 +46,7 @@ public class ResponseWithHandlebarsRegexTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("abc");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("abc");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -64,7 +65,7 @@ public class ResponseWithHandlebarsRegexTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -83,7 +84,7 @@ public class ResponseWithHandlebarsRegexTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("5000-https");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("5000-https");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -102,7 +103,7 @@ public class ResponseWithHandlebarsRegexTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -117,7 +118,10 @@ public class ResponseWithHandlebarsRegexTests
|
||||
.WithBody("{{#Regex.Match request.bodyAsJson \"^(?<proto>\\w+)://[^/]+?(?<port>\\d+)/?\"}}{{/Regex.Match}}")
|
||||
.WithTransformer();
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings)).Throws<ArgumentNullException>();
|
||||
// Act
|
||||
Func<Task> act = () => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
act.Should().ThrowAsync<HandlebarsException>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -83,7 +82,7 @@ public class ResponseWithHandlebarsXPathTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsEqualTo("abc");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("abc");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -195,7 +194,7 @@ public class ResponseWithHandlebarsXPathTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsEqualIgnoringCase("True");
|
||||
response.Message.BodyData.BodyAsString.Should().BeEquivalentTo("True");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -223,6 +222,7 @@ public class ResponseWithHandlebarsXPathTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsEqualTo("a1");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("a1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -47,8 +47,8 @@ public class ResponseWithHandlebarsXegerTests
|
||||
|
||||
// Assert
|
||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
Check.That(j["Number"].Value<int>()).IsStrictlyGreaterThan(1000).And.IsStrictlyLessThan(9999);
|
||||
Check.That(j["Postcode"].Value<string>()).IsNotEmpty();
|
||||
j["Number"].Value<int>().Should().BeGreaterThan(1000).And.BeLessThan(9999);
|
||||
j["Postcode"].Value<string>().Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -70,7 +70,8 @@ public class ResponseWithHandlebarsXegerTests
|
||||
|
||||
// Assert
|
||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
||||
Check.That(j["Number"].Value<int>()).IsStrictlyGreaterThan(1000).And.IsStrictlyLessThan(9999);
|
||||
Check.That(j["Postcode"].Value<string>()).IsNotEmpty();
|
||||
j["Number"].Value<int>().Should().BeGreaterThan(1000).And.BeLessThan(9999);
|
||||
j["Postcode"].Value<string>().Should().NotBeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Settings;
|
||||
@@ -36,7 +35,7 @@ public class ResponseWithHeadersTests
|
||||
var response = await builder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), requestMock, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.Headers[headerName].ToString()).Equals(headerValue);
|
||||
response.Message.Headers[headerName].ToString().Should().Be(headerValue);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -52,7 +51,7 @@ public class ResponseWithHeadersTests
|
||||
var response = await builder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), requestMock, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.Headers[headerName].ToArray()).Equals(headerValues);
|
||||
response.Message.Headers[headerName].ToArray().Should().Equal(headerValues);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -67,7 +66,7 @@ public class ResponseWithHeadersTests
|
||||
var responseMessage = await response.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(responseMessage.Message.Headers["h"]).ContainsExactly("x");
|
||||
responseMessage.Message.Headers["h"].Should().ContainSingle("x");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -82,7 +81,7 @@ public class ResponseWithHeadersTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.Headers["h"]).ContainsExactly("x");
|
||||
response.Message.Headers["h"].Should().ContainSingle("x");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -97,6 +96,6 @@ public class ResponseWithHeadersTests
|
||||
var response = await builder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.Headers["h"]).ContainsExactly("x");
|
||||
response.Message.Headers["h"].Should().ContainSingle("x");
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
using WireMock.Models;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -56,10 +55,10 @@ public class ResponseWithProxyTests : IDisposable
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(request.ProxyUrl).IsNotNull();
|
||||
Check.That(response.Message.BodyData.BodyAsString).IsEqualTo(expectedBody);
|
||||
Check.That(response.Message.StatusCode).IsEqualTo(201);
|
||||
Check.That(response.Message.Headers["Content-Type"].ToString()).IsEqualTo("application/json");
|
||||
request.ProxyUrl.Should().NotBeNull();
|
||||
response.Message.BodyData.BodyAsString.Should().Be(expectedBody);
|
||||
response.Message.StatusCode.Should().Be(201);
|
||||
response.Message.Headers["Content-Type"].ToString().Should().Be("application/json");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -80,8 +79,10 @@ public class ResponseWithProxyTests : IDisposable
|
||||
|
||||
// Act
|
||||
var request = new RequestMessage(new UrlDetails($"{_server.Urls[0]}/{_guid}"), "GET", ClientIp);
|
||||
Func<Task> act = () => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings)).Throws<HttpRequestException>();
|
||||
// Assert
|
||||
act.Should().ThrowAsync<HttpRequestException>();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -89,4 +90,5 @@ public class ResponseWithProxyTests : IDisposable
|
||||
_server?.Stop();
|
||||
_server?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using NFluent;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Settings;
|
||||
@@ -9,11 +7,7 @@ using WireMock.Types;
|
||||
using WireMock.Util;
|
||||
using WireMock.Handlers;
|
||||
using Moq;
|
||||
#if NET452
|
||||
using Microsoft.Owin;
|
||||
#else
|
||||
using Microsoft.AspNetCore.Http;
|
||||
#endif
|
||||
|
||||
namespace WireMock.Net.Tests.ResponseBuilders;
|
||||
|
||||
@@ -69,6 +63,7 @@ public class ResponseWithScribanTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData.BodyAsString).Equals("test http://localhost/foo /foo POSt");
|
||||
response.Message.BodyData.BodyAsString.Should().Be("test http://localhost/foo /foo POSt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Net;
|
||||
using AwesomeAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using WireMock.Models;
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -76,7 +75,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test http://localhost/foo /foo POSt");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test http://localhost/foo /foo POSt");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -100,7 +99,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("url=http://localhost/a/b absoluteurl=http://localhost/wiremock/a/b path=/a/b absolutepath=/wiremock/a/b");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("url=http://localhost/a/b absoluteurl=http://localhost/wiremock/a/b path=/a/b absolutepath=/wiremock/a/b");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -118,7 +117,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("a b wiremock");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("a b wiremock");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -141,7 +140,7 @@ public class ResponseWithTransformerTests
|
||||
|
||||
// Assert
|
||||
var json = (JObject)response.Message.BodyData!.BodyAsJson!;
|
||||
Check.That(json["field"]!.Value<string>()).Equals(expected);
|
||||
json["field"]!.Value<string>().Should().Be(expected);
|
||||
}
|
||||
|
||||
[Theory(Skip = "Invalid token `OpenBracket`")]
|
||||
@@ -161,7 +160,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("a wiremock");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("a wiremock");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -183,7 +182,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test keya=1,2 idx=1 idx=2 keyb=5");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test keya=1,2 idx=1 idx=2 keyb=5");
|
||||
}
|
||||
|
||||
[Theory(Skip = "Invalid token `OpenBracket`")]
|
||||
@@ -207,7 +206,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test keya=1 idx=1 idx=2 keyb=5");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test keya=1 idx=1 idx=2 keyb=5");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -230,8 +229,8 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.StatusCode).Equals("400");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.StatusCode.Should().Be("400");
|
||||
}
|
||||
|
||||
[Theory(Skip = "WireMockList is not supported by Scriban")]
|
||||
@@ -256,8 +255,8 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.StatusCode).Equals("400");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.StatusCode.Should().Be("400");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -282,8 +281,8 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.StatusCode).Equals(null);
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.StatusCode.Should().Be(null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -303,9 +302,9 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.Headers).ContainsKey("x");
|
||||
Check.That(response.Message.Headers!["x"]).ContainsExactly("text/plain");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.Headers.Should().ContainKey("x");
|
||||
response.Message.Headers!["x"].Should().ContainSingle("text/plain");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -329,8 +328,8 @@ public class ResponseWithTransformerTests
|
||||
|
||||
// Assert
|
||||
response.Message.Headers.Should().NotBeNull();
|
||||
Check.That(response.Message.Headers).ContainsKey("x");
|
||||
Check.That(response.Message.Headers!["x"]).ContainsExactly(guid.ToString());
|
||||
response.Message.Headers.Should().ContainKey("x");
|
||||
response.Message.Headers!["x"].Should().ContainSingle(guid.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -350,10 +349,10 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.Headers).ContainsKey("x");
|
||||
Check.That(response.Message.Headers!["x"]).Contains("text/plain");
|
||||
Check.That(response.Message.Headers["x"]).Contains("http://localhost/foo");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.Headers.Should().ContainKey("x");
|
||||
response.Message.Headers!["x"].Should().Contain("text/plain");
|
||||
response.Message.Headers["x"].Should().Contain("http://localhost/foo");
|
||||
}
|
||||
|
||||
[Theory(Skip = "WireMockList is not supported by Scriban")]
|
||||
@@ -375,10 +374,10 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.Headers).ContainsKey("x");
|
||||
Check.That(response.Message.Headers!["x"]).Contains("text/plain");
|
||||
Check.That(response.Message.Headers["x"]).Contains("http://localhost/foo");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.Headers.Should().ContainKey("x");
|
||||
response.Message.Headers!["x"].Should().Contain("text/plain");
|
||||
response.Message.Headers["x"].Should().Contain("http://localhost/foo");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -403,7 +402,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test http://localhost:1234 1234 http localhost");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test http://localhost:1234 1234 http localhost");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -430,7 +429,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson)).Equals("{\"x\":\"test /foo_object\"}");
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("{\"x\":\"test /foo_object\"}");
|
||||
}
|
||||
|
||||
[CulturedTheory(["en-US"])]
|
||||
@@ -577,7 +576,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson)).Equals("[\"first\",\"/foo_array\",\"test 1\",\"test 2\",\"last\"]");
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("[\"first\",\"/foo_array\",\"test 1\",\"test 2\",\"last\"]");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -594,7 +593,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsFile).Equals(@"c:\1\test.xml");
|
||||
response.Message.BodyData!.BodyAsFile.Should().Be(@"c:\1\test.xml");
|
||||
}
|
||||
|
||||
[Theory(Skip = @"Does not work in Scriban --> c:\\[""1""]\\test.xml")]
|
||||
@@ -613,7 +612,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsFile).Equals(@"c:\1\test.xml");
|
||||
response.Message.BodyData!.BodyAsFile.Should().Be(@"c:\1\test.xml");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -637,9 +636,9 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsFile).Equals(@"c:\1\test.xml");
|
||||
Check.That(response.Message.BodyData.DetectedBodyType).Equals(BodyType.String);
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("<xml MyUniqueNumber=\"1\"></xml>");
|
||||
response.Message.BodyData!.BodyAsFile.Should().Be(@"c:\1\test.xml");
|
||||
response.Message.BodyData.DetectedBodyType.Should().Be(BodyType.String);
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("<xml MyUniqueNumber=\"1\"></xml>");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -666,7 +665,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson)).Equals("\"test\"");
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("\"test\"");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -712,7 +711,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson)).Equals("{\"name\":\"WireMock\"}");
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("{\"name\":\"WireMock\"}");
|
||||
}
|
||||
|
||||
[Theory(Skip = "{{{ }}} Does not work in Scriban")]
|
||||
@@ -738,7 +737,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson)).Equals("{\"name\":\"WireMock\"}");
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("{\"name\":\"WireMock\"}");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -847,4 +846,7 @@ AAAADElEQVR4XmMQYNgAAADkAMHebX3mAAAAAElFTkSuQmCC
|
||||
// Assert
|
||||
response.Message.BodyData!.BodyAsString.Should().Be(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Net.Tests.VerifyExtensions;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Models;
|
||||
using WireMock.RequestBuilders;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using JsonConverter.Newtonsoft.Json;
|
||||
using WireMock.Admin.Mappings;
|
||||
using WireMock.Serialization;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AnyOfTypes;
|
||||
using AwesomeAssertions;
|
||||
using AwesomeAssertions.Execution;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using NFluent;
|
||||
using WireMock.Admin.Mappings;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Matchers;
|
||||
@@ -289,8 +287,11 @@ message HelloReply {
|
||||
// Assign
|
||||
var model = new MatcherModel { Name = "test" };
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
|
||||
// Act
|
||||
Action act = () => _sut.Map(model);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<NotSupportedException>();
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
@@ -747,7 +748,7 @@ message HelloReply {
|
||||
var matcher = (ExactMatcher)_sut.Map(model)!;
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
|
||||
matcher.GetPatterns().Should().ContainInOrder("x", "y");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -808,7 +809,7 @@ message HelloReply {
|
||||
var matcher = (ExactObjectMatcher)_sut.Map(model)!;
|
||||
|
||||
// Assert
|
||||
Check.That((byte[])matcher.Value).ContainsExactly(115, 116, 101, 102);
|
||||
((byte[])matcher.Value).Should().BeEquivalentTo(new byte[] { 115, 116, 101, 102 });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -821,8 +822,11 @@ message HelloReply {
|
||||
Patterns = ["_"]
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
Check.ThatCode(() => _sut.Map(model)).Throws<ArgumentException>();
|
||||
// Act
|
||||
Action act = () => _sut.Map(model);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<ArgumentException>();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -844,7 +848,7 @@ message HelloReply {
|
||||
var matcher = (RegexMatcher)_sut.Map(model)!;
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
|
||||
matcher.GetPatterns().Should().ContainInOrder("x", "y");
|
||||
|
||||
var result = matcher.IsMatch("X");
|
||||
result.Score.Should().Be(expected);
|
||||
@@ -869,7 +873,7 @@ message HelloReply {
|
||||
var matcher = (WildcardMatcher)_sut.Map(model)!;
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
|
||||
matcher.GetPatterns().Should().ContainInOrder("x", "y");
|
||||
|
||||
var result = matcher.IsMatch("X");
|
||||
result.Score.Should().Be(expected);
|
||||
@@ -925,7 +929,7 @@ message HelloReply {
|
||||
var matcher = (SimMetricsMatcher)_sut.Map(model)!;
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x");
|
||||
matcher.GetPatterns().Should().ContainSingle("x");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -942,7 +946,7 @@ message HelloReply {
|
||||
var matcher = (SimMetricsMatcher)_sut.Map(model)!;
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x");
|
||||
matcher.GetPatterns().Should().ContainSingle("x");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -956,7 +960,10 @@ message HelloReply {
|
||||
};
|
||||
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
|
||||
Action act = () => _sut.Map(model);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<NotSupportedException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -970,7 +977,10 @@ message HelloReply {
|
||||
};
|
||||
|
||||
// Act
|
||||
Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
|
||||
Action act = () => _sut.Map(model);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<NotSupportedException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using HandlebarsDotNet;
|
||||
using HandlebarsDotNet.Helpers.Enums;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using NFluent;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Types;
|
||||
|
||||
@@ -55,8 +53,8 @@ public class SimpleSettingsParserTests
|
||||
string? value2 = _parser.GetStringValue("test2");
|
||||
|
||||
// Assert
|
||||
Check.That(value1).IsEqualTo("one");
|
||||
Check.That(value2).IsEqualTo("two");
|
||||
value1.Should().Be("one");
|
||||
value2.Should().Be("two");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -71,9 +69,9 @@ public class SimpleSettingsParserTests
|
||||
string? value3 = _parser.GetStringValue("test3");
|
||||
|
||||
// Assert
|
||||
Check.That(value1).IsEqualTo("one");
|
||||
Check.That(value2).IsEqualTo("two");
|
||||
Check.That(value3).IsEqualTo("three");
|
||||
value1.Should().Be("one");
|
||||
value2.Should().Be("two");
|
||||
value3.Should().Be("three");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -88,9 +86,9 @@ public class SimpleSettingsParserTests
|
||||
string? value3 = _parser.GetStringValue("test3");
|
||||
|
||||
// Assert
|
||||
Check.That(value1).IsEqualTo("one");
|
||||
Check.That(value2).IsEqualTo("two");
|
||||
Check.That(value3).IsEqualTo("three");
|
||||
value1.Should().Be("one");
|
||||
value2.Should().Be("two");
|
||||
value3.Should().Be("three");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -105,9 +103,9 @@ public class SimpleSettingsParserTests
|
||||
bool value3 = _parser.GetBoolValue("test3", true);
|
||||
|
||||
// Assert
|
||||
Check.That(value1).IsEqualTo(false);
|
||||
Check.That(value2).IsEqualTo(true);
|
||||
Check.That(value3).IsEqualTo(true);
|
||||
value1.Should().Be(false);
|
||||
value2.Should().Be(true);
|
||||
value3.Should().Be(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -122,9 +120,9 @@ public class SimpleSettingsParserTests
|
||||
bool value3 = _parser.GetBoolWithDefault("missing1", "missing2", defaultValue: true);
|
||||
|
||||
// Assert
|
||||
Check.That(value1).IsEqualTo(true);
|
||||
Check.That(value2).IsEqualTo(false);
|
||||
Check.That(value3).IsEqualTo(true);
|
||||
value1.Should().Be(true);
|
||||
value2.Should().Be(false);
|
||||
value3.Should().Be(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -144,9 +142,9 @@ public class SimpleSettingsParserTests
|
||||
bool value3 = _parser.GetBoolValue("test3", true);
|
||||
|
||||
// Assert
|
||||
Check.That(value1).IsEqualTo(false);
|
||||
Check.That(value2).IsEqualTo(true);
|
||||
Check.That(value3).IsEqualTo(true);
|
||||
value1.Should().Be(false);
|
||||
value2.Should().Be(true);
|
||||
value3.Should().Be(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -162,10 +160,10 @@ public class SimpleSettingsParserTests
|
||||
int? value4 = _parser.GetIntValue("test4");
|
||||
|
||||
// Assert
|
||||
Check.That(value1).IsEqualTo(42);
|
||||
Check.That(value2).IsEqualTo(55);
|
||||
Check.That(value3).IsEqualTo(100);
|
||||
Check.That(value4).IsNull();
|
||||
value1.Should().Be(42);
|
||||
value2.Should().Be(55);
|
||||
value3.Should().Be(100);
|
||||
value4.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -186,10 +184,10 @@ public class SimpleSettingsParserTests
|
||||
int? value4 = _parser.GetIntValue("test4");
|
||||
|
||||
// Assert
|
||||
Check.That(value1).IsEqualTo(42);
|
||||
Check.That(value2).IsEqualTo(55);
|
||||
Check.That(value3).IsEqualTo(100);
|
||||
Check.That(value4).IsNull();
|
||||
value1.Should().Be(42);
|
||||
value2.Should().Be(55);
|
||||
value3.Should().Be(100);
|
||||
value4.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -209,4 +207,4 @@ public class SimpleSettingsParserTests
|
||||
};
|
||||
value.Should().BeEquivalentTo(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Settings;
|
||||
|
||||
namespace WireMock.Net.Tests.Settings;
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using AwesomeAssertions;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Server;
|
||||
@@ -29,7 +28,7 @@ public class StatefulBehaviorTests
|
||||
var response = await new HttpClient().GetAsync("http://localhost:" + server.Ports[0] + path, TestContext.Current.CancellationToken);
|
||||
|
||||
// then
|
||||
Check.That(response.StatusCode).IsEqualTo(HttpStatusCode.NotFound);
|
||||
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
@@ -59,8 +58,8 @@ public class StatefulBehaviorTests
|
||||
var responseWithState = await new HttpClient().GetStringAsync(server.Url + path, cancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(responseNoState).Equals("No state msg");
|
||||
Check.That(responseWithState).Equals("Test state msg");
|
||||
responseNoState.Should().Be("No state msg");
|
||||
responseWithState.Should().Be("Test state msg");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -104,11 +103,11 @@ public class StatefulBehaviorTests
|
||||
var responseB = await client.GetStringAsync(server.Url + path, cancellationToken);
|
||||
|
||||
// Assert
|
||||
Check.That(response1).Equals("step 1");
|
||||
Check.That(response2).Equals("step 2");
|
||||
Check.That(response3).Equals("step 3");
|
||||
Check.That(responseA).Equals(expected1);
|
||||
Check.That(responseB).Equals(expected2);
|
||||
response1.Should().Be("step 1");
|
||||
response2.Should().Be("step 2");
|
||||
response3.Should().Be("step 3");
|
||||
responseA.Should().Be(expected1);
|
||||
responseB.Should().Be(expected2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -225,8 +224,8 @@ public class StatefulBehaviorTests
|
||||
var responseWithIntState = await new HttpClient().GetStringAsync("http://localhost:" + server.Ports[0] + path, cancellationToken);
|
||||
|
||||
// then
|
||||
Check.That(responseIntScenario).Equals("Scenario 1, Setting State 2");
|
||||
Check.That(responseWithIntState).Equals("Scenario 1, State 2");
|
||||
responseIntScenario.Should().Be("Scenario 1, Setting State 2");
|
||||
responseWithIntState.Should().Be("Scenario 1, State 2");
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
@@ -256,8 +255,8 @@ public class StatefulBehaviorTests
|
||||
var responseWithIntState = await new HttpClient().GetStringAsync("http://localhost:" + server.Ports[0] + path, cancellationToken);
|
||||
|
||||
// then
|
||||
Check.That(responseIntScenario).Equals("string state, Setting State 2");
|
||||
Check.That(responseWithIntState).Equals("string state, State 2");
|
||||
responseIntScenario.Should().Be("string state, Setting State 2");
|
||||
responseWithIntState.Should().Be("string state, State 2");
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
@@ -287,8 +286,8 @@ public class StatefulBehaviorTests
|
||||
var responseWithIntState = await new HttpClient().GetStringAsync("http://localhost:" + server.Ports[0] + path, cancellationToken);
|
||||
|
||||
// then
|
||||
Check.That(responseIntScenario).Equals("int state, Setting State 2");
|
||||
Check.That(responseWithIntState).Equals("string state, State 2");
|
||||
responseIntScenario.Should().Be("int state, Setting State 2");
|
||||
responseWithIntState.Should().Be("string state, State 2");
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
@@ -320,32 +319,32 @@ public class StatefulBehaviorTests
|
||||
.WhenStateIs("Cancel newspaper item added")
|
||||
.RespondWith(Response.Create().WithBody("Buy milk;Cancel newspaper subscription"));
|
||||
|
||||
Check.That(server.Scenarios.Any()).IsFalse();
|
||||
server.Scenarios.Any().Should().BeFalse();
|
||||
|
||||
// Act and Assert
|
||||
var getResponse1 = await client.GetStringAsync("/todo/items", cancelationToken);
|
||||
Check.That(getResponse1).Equals("Buy milk");
|
||||
getResponse1.Should().Be("Buy milk");
|
||||
|
||||
Check.That(server.Scenarios["To do list"].Name).IsEqualTo("To do list");
|
||||
Check.That(server.Scenarios["To do list"].NextState).IsEqualTo("TodoList State Started");
|
||||
Check.That(server.Scenarios["To do list"].Started).IsTrue();
|
||||
Check.That(server.Scenarios["To do list"].Finished).IsFalse();
|
||||
server.Scenarios["To do list"].Name.Should().Be("To do list");
|
||||
server.Scenarios["To do list"].NextState.Should().Be("TodoList State Started");
|
||||
server.Scenarios["To do list"].Started.Should().BeTrue();
|
||||
server.Scenarios["To do list"].Finished.Should().BeFalse();
|
||||
|
||||
var postResponse = await client.PostAsync("/todo/items", new StringContent("Cancel newspaper subscription"), cancelationToken);
|
||||
Check.That(postResponse.StatusCode).Equals(HttpStatusCode.Created);
|
||||
postResponse.StatusCode.Should().Be(HttpStatusCode.Created);
|
||||
|
||||
Check.That(server.Scenarios["To do list"].Name).IsEqualTo("To do list");
|
||||
Check.That(server.Scenarios["To do list"].NextState).IsEqualTo("Cancel newspaper item added");
|
||||
Check.That(server.Scenarios["To do list"].Started).IsTrue();
|
||||
Check.That(server.Scenarios["To do list"].Finished).IsFalse();
|
||||
server.Scenarios["To do list"].Name.Should().Be("To do list");
|
||||
server.Scenarios["To do list"].NextState.Should().Be("Cancel newspaper item added");
|
||||
server.Scenarios["To do list"].Started.Should().BeTrue();
|
||||
server.Scenarios["To do list"].Finished.Should().BeFalse();
|
||||
|
||||
string getResponse2 = await client.GetStringAsync("/todo/items", cancelationToken);
|
||||
Check.That(getResponse2).Equals("Buy milk;Cancel newspaper subscription");
|
||||
getResponse2.Should().Be("Buy milk;Cancel newspaper subscription");
|
||||
|
||||
Check.That(server.Scenarios["To do list"].Name).IsEqualTo("To do list");
|
||||
Check.That(server.Scenarios["To do list"].NextState).IsNull();
|
||||
Check.That(server.Scenarios["To do list"].Started).IsTrue();
|
||||
Check.That(server.Scenarios["To do list"].Finished).IsTrue();
|
||||
server.Scenarios["To do list"].Name.Should().Be("To do list");
|
||||
server.Scenarios["To do list"].NextState.Should().BeNull();
|
||||
server.Scenarios["To do list"].Started.Should().BeTrue();
|
||||
server.Scenarios["To do list"].Finished.Should().BeTrue();
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
@@ -448,17 +447,18 @@ public class StatefulBehaviorTests
|
||||
// Act and Assert
|
||||
string url = "http://localhost:" + server.Ports[0];
|
||||
var responseNoState1 = await new HttpClient().GetStringAsync(url + "/state1", cancelationToken);
|
||||
Check.That(responseNoState1).Equals("No state msg 1");
|
||||
responseNoState1.Should().Be("No state msg 1");
|
||||
|
||||
var responseNoState2 = await new HttpClient().GetStringAsync(url + "/state2", cancelationToken);
|
||||
Check.That(responseNoState2).Equals("No state msg 2");
|
||||
responseNoState2.Should().Be("No state msg 2");
|
||||
|
||||
var responseWithState1 = await new HttpClient().GetStringAsync(url + "/foo1X", cancelationToken);
|
||||
Check.That(responseWithState1).Equals("Test state msg 1");
|
||||
responseWithState1.Should().Be("Test state msg 1");
|
||||
|
||||
var responseWithState2 = await new HttpClient().GetStringAsync(url + "/foo2X", cancelationToken);
|
||||
Check.That(responseWithState2).Equals("Test state msg 2");
|
||||
responseWithState2.Should().Be("Test state msg 2");
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using WireMock.Net.Testcontainers.Utils;
|
||||
|
||||
namespace WireMock.Net.Tests.Testcontainers;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using AwesomeAssertions;
|
||||
using Moq;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Settings;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user