예제 #1
0
        public void PickBundle_3()
        {
            var messages = new List <PieceRequest> ();

            peers[2].IsChoking = false;
            peers[2].BitField.SetAll(true);
            messages.Add(picker.PickPiece(peers[2], peers[2].BitField, peers));

            peer.IsChoking = false;

            for (int i = 0; i < 7; i++)
            {
                peer.BitField[i] = true;
            }

            IList <PieceRequest> bundle;
            PieceRequest         request;

            while ((bundle = picker.PickPiece(peer, peer.BitField, peers, torrentData.BlocksPerPiece * 5)) != null)
            {
                messages.AddRange(bundle);
            }
            while ((request = picker.ContinueAnyExisting(peer, 0, bitfield.Length - 1)) != null)
            {
                messages.Add(request);
            }

            Assert.AreEqual(torrentData.BlocksPerPiece * 7, messages.Count, "#2");
        }