mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-14 13:10:22 +02:00
Update NotNullOrEmptyMatcher to also implement IStringMatcher (#654)
* Update NotNullOrEmptyMatcher to also implement IStringMatcher * NotNullOrEmptyMatcher_GetPatterns_Should_Return_EmptyArray * 24
This commit is contained in:
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,3 +1,9 @@
|
|||||||
|
# 1.4.24 (15 October 2021)
|
||||||
|
- [#643](https://github.com/WireMock-Net/WireMock.Net/pull/643) - Support edge case: first object, next an array. [feature] contributed by [leolplex](https://github.com/leolplex)
|
||||||
|
- [#644](https://github.com/WireMock-Net/WireMock.Net/pull/644) - Mapping headers in OpenAPI [feature] contributed by [leolplex](https://github.com/leolplex)
|
||||||
|
- [#649](https://github.com/WireMock-Net/WireMock.Net/pull/649) - Refactor method name MapHeaders and httpStatusCode contributed by [leolplex](https://github.com/leolplex)
|
||||||
|
- [#651](https://github.com/WireMock-Net/WireMock.Net/pull/651) - Implement PatternAsFile for StringMatcher [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
|
||||||
# 1.4.23 (27 September 2021)
|
# 1.4.23 (27 September 2021)
|
||||||
- [#635](https://github.com/WireMock-Net/WireMock.Net/pull/635) - WireMock.Net.FluentAssertions : upgrade to latest FluentAssertions [feature] contributed by [StefH](https://github.com/StefH)
|
- [#635](https://github.com/WireMock-Net/WireMock.Net/pull/635) - WireMock.Net.FluentAssertions : upgrade to latest FluentAssertions [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#634](https://github.com/WireMock-Net/WireMock.Net/issues/634) - Upgrade to latest FluentAssertions [bug]
|
- [#634](https://github.com/WireMock-Net/WireMock.Net/issues/634) - Upgrade to latest FluentAssertions [bug]
|
||||||
@@ -111,7 +117,6 @@
|
|||||||
- [#549](https://github.com/WireMock-Net/WireMock.Net/issues/549) - WithProxy(...) does not save the mappings to file [bug]
|
- [#549](https://github.com/WireMock-Net/WireMock.Net/issues/549) - WithProxy(...) does not save the mappings to file [bug]
|
||||||
|
|
||||||
# 1.3.8 (03 December 2020)
|
# 1.3.8 (03 December 2020)
|
||||||
- [#539](https://github.com/WireMock-Net/WireMock.Net/pull/539) - Support for partial JSON matching contributed by [gleb-osokin](https://github.com/gleb-osokin)
|
|
||||||
- [#542](https://github.com/WireMock-Net/WireMock.Net/pull/542) - Create dotnet-wiremock tool [feature] contributed by [StefH](https://github.com/StefH)
|
- [#542](https://github.com/WireMock-Net/WireMock.Net/pull/542) - Create dotnet-wiremock tool [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#543](https://github.com/WireMock-Net/WireMock.Net/pull/543) - Add support for .NET 5 [feature] contributed by [StefH](https://github.com/StefH)
|
- [#543](https://github.com/WireMock-Net/WireMock.Net/pull/543) - Add support for .NET 5 [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#544](https://github.com/WireMock-Net/WireMock.Net/pull/544) - Use Java 11 in Azure Pipelines (needed for SonarCloud) [feature] contributed by [StefH](https://github.com/StefH)
|
- [#544](https://github.com/WireMock-Net/WireMock.Net/pull/544) - Use Java 11 in Azure Pipelines (needed for SonarCloud) [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
@@ -119,6 +124,9 @@
|
|||||||
- [#547](https://github.com/WireMock-Net/WireMock.Net/pull/547) - Fix Proxying with SSL and NetCoreApp3.1 [bug] contributed by [StefH](https://github.com/StefH)
|
- [#547](https://github.com/WireMock-Net/WireMock.Net/pull/547) - Fix Proxying with SSL and NetCoreApp3.1 [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#524](https://github.com/WireMock-Net/WireMock.Net/issues/524) - Proxying with SSL Not Working in .NET Core 3.1 [bug]
|
- [#524](https://github.com/WireMock-Net/WireMock.Net/issues/524) - Proxying with SSL Not Working in .NET Core 3.1 [bug]
|
||||||
|
|
||||||
|
# 1.3.7 (17 November 2020)
|
||||||
|
- [#539](https://github.com/WireMock-Net/WireMock.Net/pull/539) - Support for partial JSON matching contributed by [gleb-osokin](https://github.com/gleb-osokin)
|
||||||
|
|
||||||
# 1.3.6 (10 November 2020)
|
# 1.3.6 (10 November 2020)
|
||||||
- [#529](https://github.com/WireMock-Net/WireMock.Net/pull/529) - Add assertions for ClientIP, Url and ProxyUrl [feature] contributed by [akamud](https://github.com/akamud)
|
- [#529](https://github.com/WireMock-Net/WireMock.Net/pull/529) - Add assertions for ClientIP, Url and ProxyUrl [feature] contributed by [akamud](https://github.com/akamud)
|
||||||
- [#535](https://github.com/WireMock-Net/WireMock.Net/pull/535) - WithCallback should use also use enum HttpStatusCode [bug] contributed by [StefH](https://github.com/StefH)
|
- [#535](https://github.com/WireMock-Net/WireMock.Net/pull/535) - WithCallback should use also use enum HttpStatusCode [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
rem https://github.com/StefH/GitHubReleaseNotes
|
rem https://github.com/StefH/GitHubReleaseNotes
|
||||||
|
|
||||||
SET version=1.4.23
|
SET version=1.4.24
|
||||||
|
|
||||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate --version %version% --token %GH_TOKEN%
|
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate --version %version% --token %GH_TOKEN%
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# 1.4.23 (27 September 2021)
|
# 1.4.24 (15 October 2021)
|
||||||
- #635 WireMock.Net.FluentAssertions : upgrade to latest FluentAssertions [feature]
|
- #643 Support edge case: first object, next an array. [feature]
|
||||||
- #634 Upgrade to latest FluentAssertions [bug]
|
- #644 Mapping headers in OpenAPI [feature]
|
||||||
|
- #649 Refactor method name MapHeaders and httpStatusCode
|
||||||
|
- #651 Implement PatternAsFile for StringMatcher [feature]
|
||||||
|
|
||||||
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
|
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using AnyOfTypes;
|
||||||
|
using WireMock.Models;
|
||||||
|
|
||||||
namespace WireMock.Matchers
|
namespace WireMock.Matchers
|
||||||
{
|
{
|
||||||
@@ -6,7 +8,7 @@ namespace WireMock.Matchers
|
|||||||
/// NotNullOrEmptyMatcher
|
/// NotNullOrEmptyMatcher
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IObjectMatcher" />
|
/// <seealso cref="IObjectMatcher" />
|
||||||
public class NotNullOrEmptyMatcher : IObjectMatcher
|
public class NotNullOrEmptyMatcher : IObjectMatcher, IStringMatcher
|
||||||
{
|
{
|
||||||
/// <inheritdoc cref="IMatcher.Name"/>
|
/// <inheritdoc cref="IMatcher.Name"/>
|
||||||
public string Name => "NotNullOrEmptyMatcher";
|
public string Name => "NotNullOrEmptyMatcher";
|
||||||
@@ -48,5 +50,19 @@ namespace WireMock.Matchers
|
|||||||
|
|
||||||
return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.ToScore(match));
|
return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.ToScore(match));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="IStringMatcher.IsMatch"/>
|
||||||
|
public double IsMatch(string input)
|
||||||
|
{
|
||||||
|
var match = !string.IsNullOrEmpty(input);
|
||||||
|
|
||||||
|
return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.ToScore(match));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="IStringMatcher.GetPatterns"/>
|
||||||
|
public AnyOf<string, StringPattern>[] GetPatterns()
|
||||||
|
{
|
||||||
|
return new AnyOf<string, StringPattern>[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,11 +36,25 @@ namespace WireMock.Net.Tests.Matchers
|
|||||||
[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 data, double expected)
|
public void NotNullOrEmptyMatcher_IsMatch_String(string @string, double expected)
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
var matcher = new NotNullOrEmptyMatcher();
|
var matcher = new NotNullOrEmptyMatcher();
|
||||||
double result = matcher.IsMatch(data);
|
double result = matcher.IsMatch(@string);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
result.Should().Be(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(null, 0.0)]
|
||||||
|
[InlineData("", 0.0)]
|
||||||
|
[InlineData("x", 1.0)]
|
||||||
|
public void NotNullOrEmptyMatcher_IsMatch_StringAsObject(string @string, double expected)
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var matcher = new NotNullOrEmptyMatcher();
|
||||||
|
double result = matcher.IsMatch((object)@string);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().Be(expected);
|
result.Should().Be(expected);
|
||||||
@@ -56,5 +70,15 @@ namespace WireMock.Net.Tests.Matchers
|
|||||||
// Assert
|
// Assert
|
||||||
result.Should().Be(1.0);
|
result.Should().Be(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void NotNullOrEmptyMatcher_GetPatterns_Should_Return_EmptyArray()
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var patterns = new NotNullOrEmptyMatcher().GetPatterns();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
patterns.Should().BeEmpty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user