Ejemplo n.º 1
0
        public void TestGetPieceLengthOnParsedFile(string file, string expected)
        {
            MetaInfoFile torrentFile = new MetaInfoFile(file);

            torrentFile.Parse();
            Assert.Equal(expected, torrentFile.GetPieceLength().ToString());
        }
Ejemplo n.º 2
0
        public void TestGetPieceLengthWithNoParseOnMetaInfoFile()
        {
            MetaInfoFile        torrentFile = new MetaInfoFile(Constants.SingleFileTorrent);
            BitTorrentException error       = Assert.Throws <BitTorrentException>(() => { UInt32 pieceLength = torrentFile.GetPieceLength(); });

            Assert.Equal("BitTorrent Error: File has not been parsed.", error.Message);
        }