Skip to content

Commit

Permalink
Fix broken tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
amacal committed Apr 25, 2017
1 parent dbbe043 commit f2603f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 9 additions & 3 deletions sources/Leak.Extensions.Metadata.Tests/MetadataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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();
}
}
Expand Down
4 changes: 3 additions & 1 deletion sources/Leak.Extensions.Peers.Tests/PeersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit f2603f3

Please sign in to comment.