Merge pull request #720 from Cucumberrbob/tests/use-theory-data

Use `TheoryData<>` instead of `Object[]` for theory data
This commit is contained in:
Roger Far 2025-03-07 12:18:07 -07:00 committed by GitHub
commit e9becefb1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 7 deletions

View file

@ -294,9 +294,17 @@ public class AllDebridTorrentClientTest
Assert.Contains(secondResult, t => t.Id == Magnet2Finished.Id.ToString()); Assert.Contains(secondResult, t => t.Id == Magnet2Finished.Id.ToString());
} }
public static IEnumerable<Object[]> DownloadingMagnetsWithProgress() public static TheoryData<Magnet, Int64> DownloadingMagnetsWithProgress()
{ {
return [[Magnet1HalfDownloaded, 50], [Magnet2QuarterDownloaded, 25]]; return new()
{
{
Magnet1HalfDownloaded, 50
},
{
Magnet2QuarterDownloaded, 25
}
};
} }
[Theory] [Theory]

View file

@ -38,7 +38,7 @@ class Mocks
public class TorrentsTest public class TorrentsTest
{ {
public static IEnumerable<Object[]> TorrentAndDownload() public static TheoryData<Torrent, List<Download>> TorrentAndDownload()
{ {
var torrent = new Torrent() var torrent = new Torrent()
{ {
@ -58,10 +58,13 @@ public class TorrentsTest
} }
]; ];
yield return return new ()
[ {
torrent, downloads {
]; torrent,
downloads
}
};
} }
[Theory] [Theory]