diff --git a/sources/Leak.Extensions.Metadata.Tests/MetadataTests.cs b/sources/Leak.Extensions.Metadata.Tests/MetadataTests.cs index df6e44b4..2dc60ed6 100644 --- a/sources/Leak.Extensions.Metadata.Tests/MetadataTests.cs +++ b/sources/Leak.Extensions.Metadata.Tests/MetadataTests.cs @@ -36,10 +36,12 @@ public void ShouldTriggerMetadataRequestedWhenLocal() data.Piece.Should().Be(7); }); + session.Coordinator.Start(); session.Coordinator.Connect(connection, handshake); - session.Coordinator.Handle(extended); + session.Coordinator.Handle(extended); session.Coordinator.SendMetadataRequest(handshake.Remote, 7); + handler.Wait().Should().BeTrue(); } } @@ -67,10 +69,12 @@ public void ShouldTriggerMetadataRejectWhenLocal() data.Piece.Should().Be(7); }); + session.Coordinator.Start(); session.Coordinator.Connect(connection, handshake); - session.Coordinator.Handle(extended); + session.Coordinator.Handle(extended); session.Coordinator.SendMetadataReject(handshake.Remote, 7); + handler.Wait().Should().BeTrue(); } } @@ -99,10 +103,12 @@ public void ShouldTriggerMetadataReceiveWhenLocal() data.Data?.Length.Should().Be(1023); }); + session.Coordinator.Start(); session.Coordinator.Connect(connection, handshake); - session.Coordinator.Handle(extended); + session.Coordinator.Handle(extended); session.Coordinator.SendMetadataPiece(handshake.Remote, 7, 6 * 16384 + 1023, new byte[1023]); + handler.Wait().Should().BeTrue(); } } diff --git a/sources/Leak.Extensions.Peers.Tests/PeersTests.cs b/sources/Leak.Extensions.Peers.Tests/PeersTests.cs index 7394b548..f1a4e41c 100644 --- a/sources/Leak.Extensions.Peers.Tests/PeersTests.cs +++ b/sources/Leak.Extensions.Peers.Tests/PeersTests.cs @@ -36,10 +36,12 @@ public void ShouldTriggerPeersDataWhenLocal() data.Remotes.Should().Contain(remote); }); + session.Coordinator.Start(); session.Coordinator.Connect(connection, handshake); - session.Coordinator.Handle(extended); + session.Coordinator.Handle(extended); session.Coordinator.SendPeers(handshake.Remote, remote); + handler.Wait().Should().BeTrue(); } }