Skip to content

Commit eb58c57

Browse files
committed
Add replyTo to the RPC server
Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent 40f55f8 commit eb58c57

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Tests/Rpc/RpcServerTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public async Task RpcServerValidateStateChange()
4141
Assert.NotNull(_management);
4242
List<(State, State)> states = [];
4343
await _management.Queue(_queueName).Exclusive(true).AutoDelete(true).DeclareAsync();
44-
TaskCompletionSource tsc = new(TaskCreationOptions.RunContinuationsAsynchronously);
44+
TaskCompletionSource<int> tsc = new(TaskCreationOptions.RunContinuationsAsynchronously);
4545
IRpcServer rpcServer = await _connection.RpcServerBuilder().Handler((context, request) =>
4646
{
4747
var m = context.Message(request.Body());
@@ -52,12 +52,13 @@ public async Task RpcServerValidateStateChange()
5252
states.Add((fromState, toState));
5353
if (states.Count == 2)
5454
{
55-
tsc.SetResult();
55+
tsc.SetResult(states.Count);
5656
}
5757
};
5858
Assert.NotNull(rpcServer);
5959
await rpcServer.CloseAsync();
60-
await tsc.Task.WaitAsync(TimeSpan.FromSeconds(5));
60+
int count = await tsc.Task.WaitAsync(TimeSpan.FromSeconds(5));
61+
Assert.Equal(2, count);
6162
Assert.Equal(State.Open, states[0].Item1);
6263
Assert.Equal(State.Closing, states[0].Item2);
6364
Assert.Equal(State.Closing, states[1].Item1);

0 commit comments

Comments
 (0)