-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrpcPredicateMatcherTests.cs
More file actions
28 lines (23 loc) · 934 Bytes
/
Copy pathGrpcPredicateMatcherTests.cs
File metadata and controls
28 lines (23 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using WireMock.Matchers;
using WireMock.Net.Google.Protobuf.Request.Matchers;
using WireMock.Net.Google.Protobuf.Response;
using WireMock.Protobuf.Client;
namespace WireMock.Net.Google.Protobuf.Tests;
public class GrpcPredicateMatcherTests
{
[Test]
public async Task IsMatch_RepeatedCall_Success()
{
// Arrange
var matcher = new GrpcPredicateMatcher<GetGroupsRequestGrpc>(
x => x.Segments.SequenceEqual(["1", "2", "3"]),
MatchBehaviour.AcceptOnMatch);
var input = new GetGroupsRequestGrpc { Segments = { "1", "2", "3" } };
var response = ResponseBuilders.Response.Create().WithBodyAsGoogleProtobuf(input);
// Act
matcher.IsMatch(response.ResponseMessage.BodyData?.BodyAsBytes);
var result = matcher.IsMatch(response.ResponseMessage.BodyData?.BodyAsBytes).IsPerfect();
// Assert
await Assert.That(result).IsTrue();
}
}