public void TestGetPieceLengthOnParsedFile(string file, string expected) { MetaInfoFile torrentFile = new MetaInfoFile(file); torrentFile.Parse(); Assert.Equal(expected, torrentFile.GetPieceLength().ToString()); }
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); }