From be900499af7f4f293597873f4614284bfb979295 Mon Sep 17 00:00:00 2001 From: Benedikt Schenkel Date: Thu, 14 Dec 2023 14:37:22 +0100 Subject: [PATCH] fix test --- .../Point/PointTest.cs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/FieldElementSubsystems.Test/Point/PointTest.cs b/src/FieldElementSubsystems.Test/Point/PointTest.cs index c0a4854..d8da307 100644 --- a/src/FieldElementSubsystems.Test/Point/PointTest.cs +++ b/src/FieldElementSubsystems.Test/Point/PointTest.cs @@ -86,22 +86,37 @@ public async Task Test_Send_Generic_Message() Message = ByteString.CopyFrom (rawBytes) }; + var point = CreateDefaultPoint(mockConnection.Object); mockConnection - .SetupSequence(m => m.SendGenericMessage(rawBytes)) + .SetupSequence(m => m.ReceivePointPosition(It.IsAny())) + .Returns(Task.FromResult(null)) + .Returns(async () => + { + await point.SendGenericMessage(genericMessage); + return null; + }) + .Returns(() => + { + cancel.Cancel(); + return new TaskCompletionSource().Task; + }); + + var args = new List(); + + mockConnection + .SetupSequence(m => m.SendGenericMessage(Capture.In(args))) .Returns(() => { cancel.Cancel(); return new TaskCompletionSource().Task; }); - var point = CreateDefaultPoint(mockConnection.Object); // Act await point.StartAsync(cancel.Token); - await point.SendGenericMessage(genericMessage); // Assert - mockConnection.Verify(v => v.SendGenericMessage(rawBytes), Times.Once()); + Assert.Equal(rawBytes, args.ToArray()[0]); } [Fact]