diff --git a/test/WireMock.Net.Tests/Matchers/JsonPartialWildcardMatcherTests.cs b/test/WireMock.Net.Tests/Matchers/JsonPartialWildcardMatcherTests.cs index 57a38710..e215d4ad 100644 --- a/test/WireMock.Net.Tests/Matchers/JsonPartialWildcardMatcherTests.cs +++ b/test/WireMock.Net.Tests/Matchers/JsonPartialWildcardMatcherTests.cs @@ -338,7 +338,7 @@ public class JsonPartialWildcardMatcherTests [InlineData("{ \"test.nested\":\"value\" }", "{\"test\":{\"nested\":\"value1\"}}")] [InlineData("{\"test\":{\"test1\":\"value\"}}", "{\"test\":{\"test1\":\"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 var matcher = new JsonPartialWildcardMatcher(value); diff --git a/test/WireMock.Net.Tests/Matchers/NotNullOrEmptyMatcherTests.cs b/test/WireMock.Net.Tests/Matchers/NotNullOrEmptyMatcherTests.cs index 9e8a89a6..8371e1c1 100644 --- a/test/WireMock.Net.Tests/Matchers/NotNullOrEmptyMatcherTests.cs +++ b/test/WireMock.Net.Tests/Matchers/NotNullOrEmptyMatcherTests.cs @@ -24,7 +24,7 @@ public class NotNullOrEmptyMatcherTests [InlineData(null, 0.0)] [InlineData(new byte[0], 0.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 var matcher = new NotNullOrEmptyMatcher(); @@ -38,7 +38,7 @@ public class NotNullOrEmptyMatcherTests [InlineData(null, 0.0)] [InlineData("", 0.0)] [InlineData("x", 1.0)] - public void NotNullOrEmptyMatcher_IsMatch_String(string @string, double expected) + public void NotNullOrEmptyMatcher_IsMatch_String(string? @string, double expected) { // Act var matcher = new NotNullOrEmptyMatcher(); @@ -52,11 +52,11 @@ public class NotNullOrEmptyMatcherTests [InlineData(null, 0.0)] [InlineData("", 0.0)] [InlineData("x", 1.0)] - public void NotNullOrEmptyMatcher_IsMatch_StringAsObject(string @string, double expected) + public void NotNullOrEmptyMatcher_IsMatch_StringAsObject(string? @string, double expected) { // Act var matcher = new NotNullOrEmptyMatcher(); - var result = matcher.IsMatch((object)@string).Score; + var result = matcher.IsMatch((object?)@string).Score; // Assert result.Should().Be(expected); diff --git a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsRandomTests.cs b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsRandomTests.cs index c4907dca..ad08d598 100644 --- a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsRandomTests.cs +++ b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsRandomTests.cs @@ -5,7 +5,6 @@ using System.Threading.Tasks; using FluentAssertions; using Moq; using Newtonsoft.Json.Linq; -using NFluent; using WireMock.Handlers; using WireMock.Models; using WireMock.ResponseBuilders; @@ -52,10 +51,10 @@ public class ResponseWithHandlebarsRandomTests var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings); // Assert - JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson); - Check.That(j["Text"].Value()).IsNotEmpty(); - Check.That(j["Integer"].Value()).IsEqualTo(1000); - Check.That(j["Long"].Value()).IsStrictlyGreaterThan(77777777).And.IsStrictlyLessThan(99999999); + JObject j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!); + j["Text"]?.Value().Should().NotBeNullOrEmpty(); + j["Integer"]?.Value().Should().Be(1000); + j["Long"]?.Value().Should().BeInRange(77777777, 99999999); } [Fact] @@ -75,8 +74,8 @@ public class ResponseWithHandlebarsRandomTests var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings); // Assert - JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson); - Check.That(j["Value"].Type).IsEqualTo(JTokenType.Boolean); + JObject j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!); + j["Value"]?.Type.Should().Be(JTokenType.Boolean); } [Theory] @@ -166,9 +165,9 @@ public class ResponseWithHandlebarsRandomTests var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings); // Assert - JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson); - string value = j["StringValue"].Value(); - Check.That(new[] { "a", "b", "c" }.Contains(value)).IsTrue(); + JObject j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!); + var value = j["StringValue"]?.Value(); + new[] { "a", "b", "c" }.Should().Contain(value); } [Fact] @@ -188,8 +187,8 @@ public class ResponseWithHandlebarsRandomTests var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings); // Assert - JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson); - Check.That(j["Integer"].Value()).IsStrictlyGreaterThan(10000000).And.IsStrictlyLessThan(99999999); + JObject j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!); + j["Integer"]?.Value().Should().BeInRange(10000000, 99999999); } [Fact] @@ -209,7 +208,7 @@ public class ResponseWithHandlebarsRandomTests var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings); // Assert - var j = JObject.FromObject(response.Message.BodyData.BodyAsJson); - j["Long"].Value().Should().BeInRange(1000000000, 9999999999); + var j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!); + j["Long"]?.Value().Should().BeInRange(1000000000, 9999999999); } } \ No newline at end of file diff --git a/test/WireMock.Net.Tests/Util/FilePathUtilsTests.cs b/test/WireMock.Net.Tests/Util/FilePathUtilsTests.cs index a53aa5bf..48cea1e4 100644 --- a/test/WireMock.Net.Tests/Util/FilePathUtilsTests.cs +++ b/test/WireMock.Net.Tests/Util/FilePathUtilsTests.cs @@ -31,7 +31,7 @@ public class FilePathUtilsTests [InlineData(@"\", "")] [InlineData(@"\\", "")] [InlineData(@"\\a", "a")] - public void PathUtils_CleanPath_RemoveLeadingDirectorySeparators(string path, string expected) + public void PathUtils_CleanPath_RemoveLeadingDirectorySeparators(string? path, string? expected) { // Arrange var cleanPath = FilePathUtils.CleanPath(path);