From 85d6b820f31ecf9f2588e5d78b22406e003b01bc Mon Sep 17 00:00:00 2001 From: Roger Far Date: Sun, 23 Feb 2025 11:42:38 -0700 Subject: [PATCH] Upgrade packages, fixed few formatting issues. --- CHANGELOG.md | 10 ++++++++ .../RdtClient.Service.Test.csproj | 21 ++++++++++------ .../DownloadStationDownloaderTest.cs | 24 +++++++++---------- .../AllDebridTorrentClientTest.cs | 12 +++++----- .../Services/TorrentsTest.cs | 24 +++++++++---------- .../RdtClient.Service.csproj | 9 +++---- 6 files changed, 59 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4442cd4..ffa8c9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.98] - 2025-02-16 +### Added +- Added unit tests, thanks @Cucumberrbob! + +### Changed +- Fixed symlinks for AllDebrid. +- Upgraded DebridLink.fr to the latest version. +- Fixed nested files in the Premiumize Provider. +- Fixed deleting of torrents in the watch folders. + ## [2.0.97] - 2025-02-16 ### Added - Added support for DebridLink.fr. diff --git a/server/RdtClient.Service.Test/RdtClient.Service.Test.csproj b/server/RdtClient.Service.Test/RdtClient.Service.Test.csproj index c7fdadd..7bb82c1 100644 --- a/server/RdtClient.Service.Test/RdtClient.Service.Test.csproj +++ b/server/RdtClient.Service.Test/RdtClient.Service.Test.csproj @@ -11,17 +11,24 @@ - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - - - - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - + diff --git a/server/RdtClient.Service.Test/Services/Downloaders/DownloadStationDownloaderTest.cs b/server/RdtClient.Service.Test/Services/Downloaders/DownloadStationDownloaderTest.cs index 8f145e2..19c4cf3 100644 --- a/server/RdtClient.Service.Test/Services/Downloaders/DownloadStationDownloaderTest.cs +++ b/server/RdtClient.Service.Test/Services/Downloaders/DownloadStationDownloaderTest.cs @@ -82,7 +82,7 @@ public class DownloadStationDownloaderTest { // Arrange var mocks = new Mocks(); - mocks.TaskEndpointMock.Setup(t => t.GetInfoAsync(mocks.Gid)).ThrowsAsync(new Exception()); + mocks.TaskEndpointMock.Setup(t => t.GetInfoAsync(mocks.Gid)).ThrowsAsync(new()); mocks.TaskEndpointMock.Setup(t => t.ListAsync()) .ReturnsAsync(new DownloadStationTaskListResponse @@ -120,7 +120,7 @@ public class DownloadStationDownloaderTest public async Task Download_After5Tries_Throws() { var mocks = new Mocks(); - mocks.TaskEndpointMock.Setup(t => t.GetInfoAsync(mocks.Gid)).ThrowsAsync(new Exception()); + mocks.TaskEndpointMock.Setup(t => t.GetInfoAsync(mocks.Gid)).ThrowsAsync(new()); var emptyListResponse = new DownloadStationTaskListResponse { @@ -136,11 +136,11 @@ public class DownloadStationDownloaderTest .ReturnsAsync(emptyListResponse); mocks.TaskEndpointMock.SetupSequence(t => t.CreateAsync(It.IsAny())) - .ThrowsAsync(new Exception()) - .ThrowsAsync(new Exception()) - .ThrowsAsync(new Exception()) - .ThrowsAsync(new Exception()) - .ThrowsAsync(new Exception()); + .ThrowsAsync(new()) + .ThrowsAsync(new()) + .ThrowsAsync(new()) + .ThrowsAsync(new()) + .ThrowsAsync(new()); var downloadStationDownloader = new DownloadStationDownloader(mocks.Gid, "https://fake.url/file.txt", @@ -166,7 +166,7 @@ public class DownloadStationDownloaderTest public async Task Download_WhenSuccessfulAfter4Tries_ReturnsGid() { var mocks = new Mocks(); - mocks.TaskEndpointMock.Setup(t => t.GetInfoAsync(mocks.Gid)).ThrowsAsync(new Exception()); + mocks.TaskEndpointMock.Setup(t => t.GetInfoAsync(mocks.Gid)).ThrowsAsync(new()); var emptyListResponse = new DownloadStationTaskListResponse { @@ -182,10 +182,10 @@ public class DownloadStationDownloaderTest .ReturnsAsync(emptyListResponse); mocks.TaskEndpointMock.SetupSequence(t => t.CreateAsync(It.IsAny())) - .ThrowsAsync(new Exception()) - .ThrowsAsync(new Exception()) - .ThrowsAsync(new Exception()) - .ThrowsAsync(new Exception()) + .ThrowsAsync(new()) + .ThrowsAsync(new()) + .ThrowsAsync(new()) + .ThrowsAsync(new()) .ReturnsAsync(new DownloadStationTaskCreateResponse { TaskId = [mocks.Gid] diff --git a/server/RdtClient.Service.Test/Services/TorrentClients/AllDebridTorrentClientTest.cs b/server/RdtClient.Service.Test/Services/TorrentClients/AllDebridTorrentClientTest.cs index 88ca92e..6ad42bf 100644 --- a/server/RdtClient.Service.Test/Services/TorrentClients/AllDebridTorrentClientTest.cs +++ b/server/RdtClient.Service.Test/Services/TorrentClients/AllDebridTorrentClientTest.cs @@ -208,9 +208,9 @@ public class AllDebridTorrentClientTest var secondResult = await allDebridTorrentClient.GetTorrents(); // Assert - Assert.Equal(1, firstResult.Count); + Assert.Single(firstResult); Assert.Equal(Magnet1Finished.Id.ToString(), firstResult.First().Id); - Assert.Equal(1, secondResult.Count); + Assert.Single(secondResult); Assert.Equal(Magnet2Finished.Id.ToString(), secondResult.First().Id); } @@ -244,7 +244,7 @@ public class AllDebridTorrentClientTest var secondResult = await allDebridTorrentClient.GetTorrents(); // Assert - Assert.Equal(1, firstResult.Count); + Assert.Single(firstResult); Assert.Equal(Magnet1Finished.Id.ToString(), firstResult[0].Id); Assert.Equal(2, secondResult.Count); Assert.Contains(secondResult, t => t.Id == Magnet1Finished.Id.ToString()); @@ -696,9 +696,9 @@ public class AllDebridTorrentClientTest public Mocks() { - LoggerMock = new Mock>(); - AllDebridClientMock = new Mock(); - AllDebridClientFactoryMock = new Mock(); + LoggerMock = new(); + AllDebridClientMock = new(); + AllDebridClientFactoryMock = new(); AllDebridClientFactoryMock.Setup(f => f.GetClient()).Returns(AllDebridClientMock.Object); } } diff --git a/server/RdtClient.Service.Test/Services/TorrentsTest.cs b/server/RdtClient.Service.Test/Services/TorrentsTest.cs index 0e89b54..c4664ef 100644 --- a/server/RdtClient.Service.Test/Services/TorrentsTest.cs +++ b/server/RdtClient.Service.Test/Services/TorrentsTest.cs @@ -46,7 +46,7 @@ public class TorrentsTest Hash = "123ABC", Category = "Movies", RdSize = 100, - TorrentId = new Guid() + TorrentId = Guid.Empty }; List downloads = @@ -58,10 +58,10 @@ public class TorrentsTest } ]; - yield return new Object[] - { + yield return + [ torrent, downloads - }; + ]; } [Theory] @@ -71,7 +71,7 @@ public class TorrentsTest // Arrange var settings = new DbSettings { - General = new DbSettingsGeneral() + General = new() { RunOnTorrentCompleteFileName = "/bin/echo", RunOnTorrentCompleteArguments = "%N %L %F %R %D %C %Z %I" @@ -90,7 +90,7 @@ public class TorrentsTest var fileSystemMock = new MockFileSystem(new Dictionary { { - filePath, new MockFileData("Test file") + filePath, new("Test file") }, }); @@ -134,7 +134,7 @@ public class TorrentsTest // Arrange var settings = new DbSettings() { - General = new DbSettingsGeneral() + General = new() { RunOnTorrentCompleteFileName = null } @@ -152,7 +152,7 @@ public class TorrentsTest var fileSystemMock = new MockFileSystem(new Dictionary { { - filePath, new MockFileData("Test file") + filePath, new("Test file") }, }); @@ -181,7 +181,7 @@ public class TorrentsTest // Arrange var settings = new DbSettings() { - General = new DbSettingsGeneral() + General = new() { RunOnTorrentCompleteFileName = "/bin/echo" } @@ -199,7 +199,7 @@ public class TorrentsTest var fileSystemMock = new MockFileSystem(new Dictionary { { - filePath, new MockFileData("Test file") + filePath, new("Test file") }, }); @@ -247,7 +247,7 @@ public class TorrentsTest // Arrange var settings = new DbSettings() { - General = new DbSettingsGeneral() + General = new() { RunOnTorrentCompleteFileName = "/bin/echo" } @@ -265,7 +265,7 @@ public class TorrentsTest var fileSystemMock = new MockFileSystem(new Dictionary { { - filePath, new MockFileData("Test file") + filePath, new("Test file") }, }); diff --git a/server/RdtClient.Service/RdtClient.Service.csproj b/server/RdtClient.Service/RdtClient.Service.csproj index e60414e..5a3a4de 100644 --- a/server/RdtClient.Service/RdtClient.Service.csproj +++ b/server/RdtClient.Service/RdtClient.Service.csproj @@ -18,13 +18,14 @@ - - + + - - + + +