public void ShouldTriggerBlockReservedSequential() { BitfieldChanged bitfieldChangedA = new BitfieldChanged { Peer = PeerHash.Random(), Bitfield = Bitfield.Sequence(true, true) }; BitfieldChanged bitfieldChangedB = new BitfieldChanged { Peer = PeerHash.Random(), Bitfield = Bitfield.Sequence(true, false) }; using (OmnibusFixture fixture = new OmnibusFixture()) using (OmnibusSession session = fixture.Start()) { Trigger trigger = Trigger.Bind(ref session.Hooks.OnBlockReserved, data => { data.Block.Should().NotBeNull(); data.Block.Piece.Index.Should().Be(0); }); session.Service.Start(); session.Service.HandleMetafileVerified(session.Metainfo); session.Service.HandleDataVerified(session.Metainfo.Pieces.Length); session.Service.Handle(bitfieldChangedA); session.Service.Handle(bitfieldChangedB); session.Pipeline.Process(); session.Service.Schedule(OmnibusStrategy.Sequential, bitfieldChangedA.Peer, 1); session.Pipeline.Process(); trigger.Wait().Should().BeTrue(); } }