public async Task ReadTorrentAsync_1File_TorrentWith1File() { var sut = new TorrentFileHelper(); var torrentFileLocation = Path.Combine(TestFilesDir, "TorrentWith1File128kb.torent"); var expectedTorrent = new ExistingTorrentFile { IsPrivate = true, Name = "TestTorrent1File128kb", TrackerAnnounceUrl = "http://mytracker.org:2710/announce", InnerTorrentFiles = new InnerTorrentFileInfo[] { new InnerTorrentFileInfo { FileLocInTorrent = "FileA.txt", FileSizeInBytes = 128 * 1024 } } }; await ReadTorrentAsyncTestBodyAsync(sut, torrentFileLocation, expectedTorrent); }
private static async Task ReadTorrentAsyncTestBodyAsync(TorrentFileHelper sut, string torrentFileLocation, ExistingTorrentFile expectedTorrent) { //Act var existingTorrent = await sut.ReadTorrentAsync(torrentFileLocation); //Assert existingTorrent.Name.Should().Be(expectedTorrent.Name); existingTorrent.IsPrivate.Should().Be(expectedTorrent.IsPrivate); existingTorrent.TrackerAnnounceUrl.Should().Be(expectedTorrent.TrackerAnnounceUrl); existingTorrent.InnerTorrentFiles.Count().Should().Be(expectedTorrent.InnerTorrentFiles.Count()); foreach (var expectedInnerTorrentFile in expectedTorrent.InnerTorrentFiles) { var existingInnerTorrentFile = existingTorrent.InnerTorrentFiles.Single(f => f.FileLocInTorrent == expectedInnerTorrentFile.FileLocInTorrent); existingInnerTorrentFile.FileSizeInBytes.Should().Be(expectedInnerTorrentFile.FileSizeInBytes); } }