public void Handle(PieceRejected data) { context.Queue.Add(() => { context.Dependencies.DataMap.Invalidate(data.Piece); }); }
public void ShouldInvalidatePieceWhenPieceIsRejected() { using (DataGetFixture fixture = new DataGetFixture()) using (DataGetSession session = fixture.Start()) { PieceRejected rejected = new PieceRejected { Hash = session.Service.Hash, Piece = new PieceInfo(1) }; session.Service.Start(); session.Service.Handle(rejected); session.Pipeline.Process(); A.CallTo(() => session.DataMap.Invalidate(rejected.Piece)).MustHaveHappened(); } }
private void OnPieceRejected(PieceRejected data) { Notifications.Enqueue(new PieceRejectedNotification(data.Hash, data.Piece)); DataGet?.Handle(data); }