Ejemplo n.º 1
0
        public void TestSetPieceLengthWithInvalidPieceNumber()
        {
            MetaInfoFile file = new MetaInfoFile(Constants.SingleFileTorrent);

            file.Parse();
            TorrentContext tc = new TorrentContext(file, new Selector(), new DiskIO(new Manager()), Constants.DestinationDirectory);

            Assert.Throws <IndexOutOfRangeException>(() => tc.SetPieceLength(Constants.InvalidPieceNumber, 0));
        }
Ejemplo n.º 2
0
        public void TestSetPieceLengthLargerThanDefaultPieceSize()
        {
            MetaInfoFile file = new MetaInfoFile(Constants.SingleFileTorrent);

            file.Parse();
            TorrentContext      tc    = new TorrentContext(file, new Selector(), new DiskIO(new Manager()), Constants.DestinationDirectory);
            BitTorrentException error = Assert.Throws <BitTorrentException>(() => tc.SetPieceLength(0, UInt32.MaxValue));

            Assert.Equal("BitTorrent Error: Piece length larger than maximum for torrent.", error.Message);
        }