Update NotNullOrEmptyMatcher to also implement IStringMatcher (#654)

* Update NotNullOrEmptyMatcher to also implement IStringMatcher

* NotNullOrEmptyMatcher_GetPatterns_Should_Return_EmptyArray

* 24
This commit is contained in:
Stef Heyenrath
2021-10-15 12:59:03 +02:00
committed by GitHub
parent 57cc616aa3
commit 6194f4e460
5 changed files with 58 additions and 8 deletions

View File

@@ -36,11 +36,25 @@ namespace WireMock.Net.Tests.Matchers
[InlineData(null, 0.0)]
[InlineData("", 0.0)]
[InlineData("x", 1.0)]
public void NotNullOrEmptyMatcher_IsMatch_String(string data, double expected)
public void NotNullOrEmptyMatcher_IsMatch_String(string @string, double expected)
{
// Act
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
result.Should().Be(expected);
@@ -56,5 +70,15 @@ namespace WireMock.Net.Tests.Matchers
// Assert
result.Should().Be(1.0);
}
[Fact]
public void NotNullOrEmptyMatcher_GetPatterns_Should_Return_EmptyArray()
{
// Act
var patterns = new NotNullOrEmptyMatcher().GetPatterns();
// Assert
patterns.Should().BeEmpty();
}
}
}