mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-23 01:04:55 +01:00
* RejectOnMatch (wip) * RejectOnMatch (wip) * RejectOnMatch (wip) * RejectOnMatch (wip) * docs: improve sample app matcher to show use of reject on match * Reworked code review comments
65 lines
1.5 KiB
C#
65 lines
1.5 KiB
C#
using NFluent;
|
|
using WireMock.Matchers;
|
|
using Xunit;
|
|
|
|
namespace WireMock.Net.Tests.Matchers
|
|
{
|
|
public class ExactObjectMatcherTests
|
|
{
|
|
[Fact]
|
|
public void ExactObjectMatcher_GetName()
|
|
{
|
|
// Assign
|
|
object obj = 1;
|
|
|
|
// Act
|
|
var matcher = new ExactObjectMatcher(obj);
|
|
string name = matcher.Name;
|
|
|
|
// Assert
|
|
Check.That(name).Equals("ExactObjectMatcher");
|
|
}
|
|
|
|
[Fact]
|
|
public void ExactObjectMatcher_IsMatch_ByteArray()
|
|
{
|
|
// Assign
|
|
object checkValue = new byte[] { 1, 2 };
|
|
|
|
// Act
|
|
var matcher = new ExactObjectMatcher(new byte[] { 1, 2 });
|
|
double result = matcher.IsMatch(checkValue);
|
|
|
|
// Assert
|
|
Check.That(result).IsEqualTo(1.0);
|
|
}
|
|
|
|
[Fact]
|
|
public void ExactObjectMatcher_IsMatch_AcceptOnMatch()
|
|
{
|
|
// Assign
|
|
object obj = 1;
|
|
|
|
// Act
|
|
var matcher = new ExactObjectMatcher(obj);
|
|
double result = matcher.IsMatch(1);
|
|
|
|
// Assert
|
|
Check.That(result).IsEqualTo(1.0);
|
|
}
|
|
|
|
[Fact]
|
|
public void ExactObjectMatcher_IsMatch_RejectOnMatch()
|
|
{
|
|
// Assign
|
|
object obj = 1;
|
|
|
|
// Act
|
|
var matcher = new ExactObjectMatcher(MatchBehaviour.RejectOnMatch, obj);
|
|
double result = matcher.IsMatch(1);
|
|
|
|
// Assert
|
|
Check.That(result).IsEqualTo(0.0);
|
|
}
|
|
}
|
|
} |