mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-18 07:00:04 +02:00
.
This commit is contained in:
@@ -338,7 +338,7 @@ public class JsonPartialWildcardMatcherTests
|
|||||||
[InlineData("{ \"test.nested\":\"value\" }", "{\"test\":{\"nested\":\"value1\"}}")]
|
[InlineData("{ \"test.nested\":\"value\" }", "{\"test\":{\"nested\":\"value1\"}}")]
|
||||||
[InlineData("{\"test\":{\"test1\":\"value\"}}", "{\"test\":{\"test1\":\"value1\"}}")]
|
[InlineData("{\"test\":{\"test1\":\"value\"}}", "{\"test\":{\"test1\":\"value1\"}}")]
|
||||||
[InlineData("[{ \"test.nested\":\"value\" }]", "[{\"test\":{\"nested\":\"value1\"}}]")]
|
[InlineData("[{ \"test.nested\":\"value\" }]", "[{\"test\":{\"nested\":\"value1\"}}]")]
|
||||||
public void JsonPartialWildcardMatcher_IsMatch_StringInputWithInvalidMatch(string value, string input)
|
public void JsonPartialWildcardMatcher_IsMatch_StringInputWithInvalidMatch(string value, string? input)
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
var matcher = new JsonPartialWildcardMatcher(value);
|
var matcher = new JsonPartialWildcardMatcher(value);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class NotNullOrEmptyMatcherTests
|
|||||||
[InlineData(null, 0.0)]
|
[InlineData(null, 0.0)]
|
||||||
[InlineData(new byte[0], 0.0)]
|
[InlineData(new byte[0], 0.0)]
|
||||||
[InlineData(new byte[] { 48 }, 1.0)]
|
[InlineData(new byte[] { 48 }, 1.0)]
|
||||||
public void NotNullOrEmptyMatcher_IsMatch_ByteArray(byte[] data, double expected)
|
public void NotNullOrEmptyMatcher_IsMatch_ByteArray(byte[]? data, double expected)
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
var matcher = new NotNullOrEmptyMatcher();
|
var matcher = new NotNullOrEmptyMatcher();
|
||||||
@@ -38,7 +38,7 @@ public class NotNullOrEmptyMatcherTests
|
|||||||
[InlineData(null, 0.0)]
|
[InlineData(null, 0.0)]
|
||||||
[InlineData("", 0.0)]
|
[InlineData("", 0.0)]
|
||||||
[InlineData("x", 1.0)]
|
[InlineData("x", 1.0)]
|
||||||
public void NotNullOrEmptyMatcher_IsMatch_String(string @string, double expected)
|
public void NotNullOrEmptyMatcher_IsMatch_String(string? @string, double expected)
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
var matcher = new NotNullOrEmptyMatcher();
|
var matcher = new NotNullOrEmptyMatcher();
|
||||||
@@ -52,11 +52,11 @@ public class NotNullOrEmptyMatcherTests
|
|||||||
[InlineData(null, 0.0)]
|
[InlineData(null, 0.0)]
|
||||||
[InlineData("", 0.0)]
|
[InlineData("", 0.0)]
|
||||||
[InlineData("x", 1.0)]
|
[InlineData("x", 1.0)]
|
||||||
public void NotNullOrEmptyMatcher_IsMatch_StringAsObject(string @string, double expected)
|
public void NotNullOrEmptyMatcher_IsMatch_StringAsObject(string? @string, double expected)
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
var matcher = new NotNullOrEmptyMatcher();
|
var matcher = new NotNullOrEmptyMatcher();
|
||||||
var result = matcher.IsMatch((object)@string).Score;
|
var result = matcher.IsMatch((object?)@string).Score;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().Be(expected);
|
result.Should().Be(expected);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using System.Threading.Tasks;
|
|||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NFluent;
|
|
||||||
using WireMock.Handlers;
|
using WireMock.Handlers;
|
||||||
using WireMock.Models;
|
using WireMock.Models;
|
||||||
using WireMock.ResponseBuilders;
|
using WireMock.ResponseBuilders;
|
||||||
@@ -52,10 +51,10 @@ public class ResponseWithHandlebarsRandomTests
|
|||||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
JObject j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||||
Check.That(j["Text"].Value<string>()).IsNotEmpty();
|
j["Text"]?.Value<string>().Should().NotBeNullOrEmpty();
|
||||||
Check.That(j["Integer"].Value<int>()).IsEqualTo(1000);
|
j["Integer"]?.Value<int>().Should().Be(1000);
|
||||||
Check.That(j["Long"].Value<long>()).IsStrictlyGreaterThan(77777777).And.IsStrictlyLessThan(99999999);
|
j["Long"]?.Value<long>().Should().BeInRange(77777777, 99999999);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -75,8 +74,8 @@ public class ResponseWithHandlebarsRandomTests
|
|||||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
JObject j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||||
Check.That(j["Value"].Type).IsEqualTo(JTokenType.Boolean);
|
j["Value"]?.Type.Should().Be(JTokenType.Boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
@@ -166,9 +165,9 @@ public class ResponseWithHandlebarsRandomTests
|
|||||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
JObject j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||||
string value = j["StringValue"].Value<string>();
|
var value = j["StringValue"]?.Value<string>();
|
||||||
Check.That(new[] { "a", "b", "c" }.Contains(value)).IsTrue();
|
new[] { "a", "b", "c" }.Should().Contain(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -188,8 +187,8 @@ public class ResponseWithHandlebarsRandomTests
|
|||||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
JObject j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||||
Check.That(j["Integer"].Value<int>()).IsStrictlyGreaterThan(10000000).And.IsStrictlyLessThan(99999999);
|
j["Integer"]?.Value<int>().Should().BeInRange(10000000, 99999999);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -209,7 +208,7 @@ public class ResponseWithHandlebarsRandomTests
|
|||||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
|
var j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
|
||||||
j["Long"].Value<long>().Should().BeInRange(1000000000, 9999999999);
|
j["Long"]?.Value<long>().Should().BeInRange(1000000000, 9999999999);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ public class FilePathUtilsTests
|
|||||||
[InlineData(@"\", "")]
|
[InlineData(@"\", "")]
|
||||||
[InlineData(@"\\", "")]
|
[InlineData(@"\\", "")]
|
||||||
[InlineData(@"\\a", "a")]
|
[InlineData(@"\\a", "a")]
|
||||||
public void PathUtils_CleanPath_RemoveLeadingDirectorySeparators(string path, string expected)
|
public void PathUtils_CleanPath_RemoveLeadingDirectorySeparators(string? path, string? expected)
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var cleanPath = FilePathUtils.CleanPath(path);
|
var cleanPath = FilePathUtils.CleanPath(path);
|
||||||
|
|||||||
Reference in New Issue
Block a user