mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-24 02:12:02 +01:00
xunit v3
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if !(NET452 || NET461)
|
||||
using System.Threading.Tasks;
|
||||
using VerifyTests;
|
||||
using VerifyXunit;
|
||||
using WireMock.Logging;
|
||||
using WireMock.Models;
|
||||
using WireMock.Net.Tests.VerifyExtensions;
|
||||
@@ -12,11 +8,9 @@ using WireMock.ResponseBuilders;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Types;
|
||||
using WireMock.Util;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Serialization;
|
||||
|
||||
[UsesVerify]
|
||||
public class LogEntryMapperTests
|
||||
{
|
||||
private static readonly VerifySettings VerifySettings = new();
|
||||
@@ -64,7 +58,7 @@ public class LogEntryMapperTests
|
||||
var result = _sut.Map(logEntry);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(result, VerifySettings);
|
||||
return Verify(result, VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -88,7 +82,7 @@ public class LogEntryMapperTests
|
||||
var result = _sut.Map(logEntry);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(result, VerifySettings);
|
||||
return Verify(result, VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -114,7 +108,7 @@ public class LogEntryMapperTests
|
||||
var result = _sut.Map(logEntry);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(result, VerifySettings);
|
||||
return Verify(result, VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -153,7 +147,6 @@ public class LogEntryMapperTests
|
||||
var result = new LogEntryMapper(options).Map(logEntry);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(result, VerifySettings);
|
||||
return Verify(result, VerifySettings);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1,21 +1,14 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using VerifyTests;
|
||||
using VerifyXunit;
|
||||
using WireMock.Net.Tests.VerifyExtensions;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Types;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Serialization;
|
||||
|
||||
[UsesVerify]
|
||||
public partial class MappingConverterTests
|
||||
{
|
||||
private static readonly VerifySettings VerifySettings = new();
|
||||
@@ -41,7 +34,7 @@ public partial class MappingConverterTests
|
||||
code.Should().NotBeEmpty();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(code, VerifySettings);
|
||||
return Verify(code, VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -61,7 +54,7 @@ public partial class MappingConverterTests
|
||||
code.Should().NotBeEmpty();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(code, VerifySettings);
|
||||
return Verify(code, VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -81,7 +74,7 @@ public partial class MappingConverterTests
|
||||
code.Should().NotBeEmpty();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(code, VerifySettings);
|
||||
return Verify(code, VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -101,7 +94,7 @@ public partial class MappingConverterTests
|
||||
code.Should().NotBeEmpty();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(code, VerifySettings);
|
||||
return Verify(code, VerifySettings);
|
||||
}
|
||||
|
||||
private IMapping CreateMapping()
|
||||
@@ -142,5 +135,4 @@ public partial class MappingConverterTests
|
||||
data: null
|
||||
).WithProbability(0.3);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1,12 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
//#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using VerifyXunit;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Models;
|
||||
using WireMock.RequestBuilders;
|
||||
@@ -15,7 +9,6 @@ using WireMock.Serialization;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Types;
|
||||
using WireMock.Util;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Serialization;
|
||||
|
||||
@@ -100,7 +93,7 @@ message HelloReply {
|
||||
model.Webhook.Request.BodyAsJson.Should().BeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -177,7 +170,7 @@ message HelloReply {
|
||||
model.Webhooks[1].Request.Body.Should().Be("2");
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -199,7 +192,7 @@ message HelloReply {
|
||||
model.Description.Should().Be(description);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -219,7 +212,7 @@ message HelloReply {
|
||||
model.Response.UseTransformer.Should().BeTrue();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -250,7 +243,7 @@ message HelloReply {
|
||||
model.TimeSettings.TTL.Should().Be(ttl);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model, VerifySettings);
|
||||
return Verify(model, VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -296,7 +289,7 @@ message HelloReply {
|
||||
model.Response.Delay.Should().Be(delay);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -318,7 +311,7 @@ message HelloReply {
|
||||
model.Response.MaximumRandomDelay.Should().Be(60_000);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -341,7 +334,7 @@ message HelloReply {
|
||||
model.Response.MaximumRandomDelay.Should().Be(maximumDelay);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -362,7 +355,7 @@ message HelloReply {
|
||||
model.Probability.Should().Be(0.4);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -380,7 +373,7 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -412,7 +405,7 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -438,7 +431,7 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -459,7 +452,7 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
#if TRAILINGHEADERS
|
||||
@@ -482,7 +475,7 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -503,7 +496,7 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -528,10 +521,9 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
//#if GRAPHQL
|
||||
[Fact]
|
||||
public Task ToMappingModel_Request_WithBodyAsGraphQLSchema_ReturnsCorrectModel()
|
||||
{
|
||||
@@ -560,11 +552,9 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
//#endif
|
||||
|
||||
//#if PROTOBUF
|
||||
[Fact]
|
||||
public Task ToMappingModel_Request_WithBodyAsProtoBuf_ReturnsCorrectModel()
|
||||
{
|
||||
@@ -587,7 +577,7 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -614,7 +604,7 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -649,8 +639,6 @@ message HelloReply {
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
return Verify(model);
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AnyOfTypes;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
@@ -14,7 +12,6 @@ using WireMock.Matchers;
|
||||
using WireMock.Models;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Settings;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Serialization;
|
||||
|
||||
@@ -56,13 +53,12 @@ public class MatcherMapperTests
|
||||
var matcherMock2 = new Mock<IStringMatcher>();
|
||||
|
||||
// Act
|
||||
var models = _sut.Map(new[] { matcherMock1.Object, matcherMock2.Object });
|
||||
var models = _sut.Map([matcherMock1.Object, matcherMock2.Object]);
|
||||
|
||||
// Assert
|
||||
models.Should().HaveCount(2);
|
||||
}
|
||||
|
||||
//#if MIMEKIT
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_Matcher_MimePartMatcher()
|
||||
{
|
||||
@@ -94,7 +90,6 @@ public class MatcherMapperTests
|
||||
model.ContentMatcher!.Name.Should().Be(nameof(ExactObjectMatcher));
|
||||
model.ContentMatcher.Pattern.Should().Be(bytes);
|
||||
}
|
||||
//#endif
|
||||
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_Matcher_IStringMatcher()
|
||||
@@ -124,7 +119,7 @@ public class MatcherMapperTests
|
||||
|
||||
var matcherMock = new Mock<IStringMatcher>();
|
||||
matcherMock.Setup(m => m.Name).Returns("test");
|
||||
matcherMock.Setup(m => m.GetPatterns()).Returns(new AnyOf<string, StringPattern>[] { pattern });
|
||||
matcherMock.Setup(m => m.GetPatterns()).Returns([pattern]);
|
||||
|
||||
// Act
|
||||
var model = _sut.Map(matcherMock.Object)!;
|
||||
@@ -171,7 +166,6 @@ public class MatcherMapperTests
|
||||
model.XmlNamespaceMap.Should().BeEquivalentTo(xmlNamespaceMap);
|
||||
}
|
||||
|
||||
//#if GRAPHQL
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_Matcher_GraphQLMatcher()
|
||||
{
|
||||
@@ -199,9 +193,7 @@ public class MatcherMapperTests
|
||||
model.Pattern.Should().Be(testSchema);
|
||||
model.CustomScalars.Should().BeEquivalentTo(customScalars);
|
||||
}
|
||||
//#endif
|
||||
|
||||
//#if PROTOBUF
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_Matcher_ProtoBufMatcher()
|
||||
{
|
||||
@@ -280,7 +272,6 @@ message HelloReply {
|
||||
model.ContentMatcher?.Name.Should().Be("JsonMatcher");
|
||||
model.ContentMatcher?.Pattern.Should().Be(jsonPattern);
|
||||
}
|
||||
//#endif
|
||||
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_MatcherModel_Null()
|
||||
@@ -598,7 +589,6 @@ message HelloReply {
|
||||
matcher.MatchBehaviour.Should().Be(MatchBehaviour.RejectOnMatch);
|
||||
}
|
||||
|
||||
//#if MIMEKIT
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_MatcherModel_MimePartMatcher()
|
||||
{
|
||||
@@ -638,7 +628,6 @@ message HelloReply {
|
||||
matcher.ContentTransferEncodingMatcher.Should().BeAssignableTo<RegexMatcher>().Which.GetPatterns().Should().ContainSingle("z");
|
||||
matcher.ContentTypeMatcher.Should().BeAssignableTo<ContentTypeMatcher>().Which.GetPatterns().Should().ContainSingle("text/json");
|
||||
}
|
||||
//#endif
|
||||
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_MatcherModel_XPathMatcher_WithXmlNamespaces_As_String()
|
||||
@@ -649,10 +638,10 @@ message HelloReply {
|
||||
{
|
||||
Name = "XPathMatcher",
|
||||
Pattern = pattern,
|
||||
XmlNamespaceMap = new[]
|
||||
{
|
||||
XmlNamespaceMap =
|
||||
[
|
||||
new XmlNamespace { Prefix = "s", Uri = "http://schemas.xmlsoap.org/soap/envelope/" }
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -812,7 +801,7 @@ message HelloReply {
|
||||
var model = new MatcherModel
|
||||
{
|
||||
Name = "ExactObjectMatcher",
|
||||
Patterns = new object[] { "c3RlZg==" }
|
||||
Patterns = ["c3RlZg=="]
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -829,7 +818,7 @@ message HelloReply {
|
||||
var model = new MatcherModel
|
||||
{
|
||||
Name = "ExactObjectMatcher",
|
||||
Patterns = new object[] { "_" }
|
||||
Patterns = ["_"]
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
@@ -1050,7 +1039,6 @@ message HelloReply {
|
||||
}
|
||||
}
|
||||
|
||||
//#if GRAPHQL
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_MatcherModel_GraphQLMatcher()
|
||||
{
|
||||
@@ -1083,9 +1071,7 @@ message HelloReply {
|
||||
matcher.Name.Should().Be(nameof(GraphQLMatcher));
|
||||
matcher.CustomScalars.Should().BeEquivalentTo(customScalars);
|
||||
}
|
||||
//#endif
|
||||
|
||||
//#if PROTOBUF
|
||||
[Fact]
|
||||
public void MatcherMapper_Map_MatcherModel_ProtoBufMatcher()
|
||||
{
|
||||
@@ -1132,5 +1118,4 @@ message HelloReply {
|
||||
matcher.MessageType.Should().Be(messageType);
|
||||
matcher.Matcher?.Value.Should().Be(jsonMatcherPattern);
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
@@ -1,23 +1,15 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using VerifyTests;
|
||||
using VerifyXunit;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Net.Tests.VerifyExtensions;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Util;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Serialization;
|
||||
|
||||
[UsesVerify]
|
||||
public class ProxyMappingConverterTests
|
||||
{
|
||||
private static readonly VerifySettings VerifySettings = new();
|
||||
@@ -79,7 +71,6 @@ public class ProxyMappingConverterTests
|
||||
var model = _mappingConverter.ToMappingModel(proxyMapping);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model, VerifySettings);
|
||||
return Verify(model, VerifySettings);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1,21 +1,14 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using VerifyTests;
|
||||
using VerifyXunit;
|
||||
using WireMock.Admin.Mappings;
|
||||
using WireMock.Models;
|
||||
using WireMock.Net.Tests.VerifyExtensions;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Types;
|
||||
using WireMock.Util;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Serialization;
|
||||
|
||||
[UsesVerify]
|
||||
public class WebhookMapperTests
|
||||
{
|
||||
private static readonly VerifySettings VerifySettings = new();
|
||||
@@ -46,7 +39,7 @@ public class WebhookMapperTests
|
||||
var result = WebhookMapper.Map(model);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(result, VerifySettings);
|
||||
return Verify(result, VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -71,7 +64,7 @@ public class WebhookMapperTests
|
||||
var result = WebhookMapper.Map(model);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(result, VerifySettings);
|
||||
return Verify(result, VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -98,7 +91,7 @@ public class WebhookMapperTests
|
||||
var result = WebhookMapper.Map(model);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(result, VerifySettings);
|
||||
return Verify(result, VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -130,7 +123,6 @@ public class WebhookMapperTests
|
||||
var result = WebhookMapper.Map(webhook);
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(result, VerifySettings);
|
||||
return Verify(result, VerifySettings);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user