Example #1
0
 public void Handle(PieceRejected data)
 {
     context.Queue.Add(() =>
     {
         context.Dependencies.DataMap.Invalidate(data.Piece);
     });
 }
Example #2
0
        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();
                }
        }
Example #3
0
 private void OnPieceRejected(PieceRejected data)
 {
     Notifications.Enqueue(new PieceRejectedNotification(data.Hash, data.Piece));
     DataGet?.Handle(data);
 }