Upgrade packages, fixed few formatting issues.

This commit is contained in:
Roger Far 2025-02-23 11:42:38 -07:00
parent 3fc44163a9
commit 85d6b820f3
6 changed files with 59 additions and 41 deletions

View file

@ -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/), 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). 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 ## [2.0.97] - 2025-02-16
### Added ### Added
- Added support for DebridLink.fr. - Added support for DebridLink.fr.

View file

@ -11,17 +11,24 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AllDebrid.NET" Version="1.0.17" /> <PackageReference Include="AllDebrid.NET" Version="1.0.17" />
<PackageReference Include="coverlet.collector" Version="6.0.2"/> <PackageReference Include="coverlet.collector" Version="6.0.4">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="Moq" Version="4.20.72" /> <PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="TestableIO.System.IO.Abstractions" Version="21.3.1" /> <PackageReference Include="TestableIO.System.IO.Abstractions" Version="22.0.10" />
<PackageReference Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="21.3.1" /> <PackageReference Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="22.0.10" />
<PackageReference Include="xunit" Version="2.9.2"/> <PackageReference Include="TestableIO.System.IO.Abstractions.Wrappers" Version="22.0.10" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"/> <PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Using Include="Xunit"/> <Using Include="Xunit" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -82,7 +82,7 @@ public class DownloadStationDownloaderTest
{ {
// Arrange // Arrange
var mocks = new Mocks(); 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()) mocks.TaskEndpointMock.Setup(t => t.ListAsync())
.ReturnsAsync(new DownloadStationTaskListResponse .ReturnsAsync(new DownloadStationTaskListResponse
@ -120,7 +120,7 @@ public class DownloadStationDownloaderTest
public async Task Download_After5Tries_Throws() public async Task Download_After5Tries_Throws()
{ {
var mocks = new Mocks(); 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 var emptyListResponse = new DownloadStationTaskListResponse
{ {
@ -136,11 +136,11 @@ public class DownloadStationDownloaderTest
.ReturnsAsync(emptyListResponse); .ReturnsAsync(emptyListResponse);
mocks.TaskEndpointMock.SetupSequence(t => t.CreateAsync(It.IsAny<DownloadStationTaskCreateRequest>())) mocks.TaskEndpointMock.SetupSequence(t => t.CreateAsync(It.IsAny<DownloadStationTaskCreateRequest>()))
.ThrowsAsync(new Exception()) .ThrowsAsync(new())
.ThrowsAsync(new Exception()) .ThrowsAsync(new())
.ThrowsAsync(new Exception()) .ThrowsAsync(new())
.ThrowsAsync(new Exception()) .ThrowsAsync(new())
.ThrowsAsync(new Exception()); .ThrowsAsync(new());
var downloadStationDownloader = new DownloadStationDownloader(mocks.Gid, var downloadStationDownloader = new DownloadStationDownloader(mocks.Gid,
"https://fake.url/file.txt", "https://fake.url/file.txt",
@ -166,7 +166,7 @@ public class DownloadStationDownloaderTest
public async Task Download_WhenSuccessfulAfter4Tries_ReturnsGid() public async Task Download_WhenSuccessfulAfter4Tries_ReturnsGid()
{ {
var mocks = new Mocks(); 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 var emptyListResponse = new DownloadStationTaskListResponse
{ {
@ -182,10 +182,10 @@ public class DownloadStationDownloaderTest
.ReturnsAsync(emptyListResponse); .ReturnsAsync(emptyListResponse);
mocks.TaskEndpointMock.SetupSequence(t => t.CreateAsync(It.IsAny<DownloadStationTaskCreateRequest>())) mocks.TaskEndpointMock.SetupSequence(t => t.CreateAsync(It.IsAny<DownloadStationTaskCreateRequest>()))
.ThrowsAsync(new Exception()) .ThrowsAsync(new())
.ThrowsAsync(new Exception()) .ThrowsAsync(new())
.ThrowsAsync(new Exception()) .ThrowsAsync(new())
.ThrowsAsync(new Exception()) .ThrowsAsync(new())
.ReturnsAsync(new DownloadStationTaskCreateResponse .ReturnsAsync(new DownloadStationTaskCreateResponse
{ {
TaskId = [mocks.Gid] TaskId = [mocks.Gid]

View file

@ -208,9 +208,9 @@ public class AllDebridTorrentClientTest
var secondResult = await allDebridTorrentClient.GetTorrents(); var secondResult = await allDebridTorrentClient.GetTorrents();
// Assert // Assert
Assert.Equal(1, firstResult.Count); Assert.Single(firstResult);
Assert.Equal(Magnet1Finished.Id.ToString(), firstResult.First().Id); Assert.Equal(Magnet1Finished.Id.ToString(), firstResult.First().Id);
Assert.Equal(1, secondResult.Count); Assert.Single(secondResult);
Assert.Equal(Magnet2Finished.Id.ToString(), secondResult.First().Id); Assert.Equal(Magnet2Finished.Id.ToString(), secondResult.First().Id);
} }
@ -244,7 +244,7 @@ public class AllDebridTorrentClientTest
var secondResult = await allDebridTorrentClient.GetTorrents(); var secondResult = await allDebridTorrentClient.GetTorrents();
// Assert // Assert
Assert.Equal(1, firstResult.Count); Assert.Single(firstResult);
Assert.Equal(Magnet1Finished.Id.ToString(), firstResult[0].Id); Assert.Equal(Magnet1Finished.Id.ToString(), firstResult[0].Id);
Assert.Equal(2, secondResult.Count); Assert.Equal(2, secondResult.Count);
Assert.Contains(secondResult, t => t.Id == Magnet1Finished.Id.ToString()); Assert.Contains(secondResult, t => t.Id == Magnet1Finished.Id.ToString());
@ -696,9 +696,9 @@ public class AllDebridTorrentClientTest
public Mocks() public Mocks()
{ {
LoggerMock = new Mock<ILogger<AllDebridTorrentClient>>(); LoggerMock = new();
AllDebridClientMock = new Mock<IAllDebridNETClient>(); AllDebridClientMock = new();
AllDebridClientFactoryMock = new Mock<IAllDebridNetClientFactory>(); AllDebridClientFactoryMock = new();
AllDebridClientFactoryMock.Setup(f => f.GetClient()).Returns(AllDebridClientMock.Object); AllDebridClientFactoryMock.Setup(f => f.GetClient()).Returns(AllDebridClientMock.Object);
} }
} }

View file

@ -46,7 +46,7 @@ public class TorrentsTest
Hash = "123ABC", Hash = "123ABC",
Category = "Movies", Category = "Movies",
RdSize = 100, RdSize = 100,
TorrentId = new Guid() TorrentId = Guid.Empty
}; };
List<Download> downloads = List<Download> downloads =
@ -58,10 +58,10 @@ public class TorrentsTest
} }
]; ];
yield return new Object[] yield return
{ [
torrent, downloads torrent, downloads
}; ];
} }
[Theory] [Theory]
@ -71,7 +71,7 @@ public class TorrentsTest
// Arrange // Arrange
var settings = new DbSettings var settings = new DbSettings
{ {
General = new DbSettingsGeneral() General = new()
{ {
RunOnTorrentCompleteFileName = "/bin/echo", RunOnTorrentCompleteFileName = "/bin/echo",
RunOnTorrentCompleteArguments = "%N %L %F %R %D %C %Z %I" RunOnTorrentCompleteArguments = "%N %L %F %R %D %C %Z %I"
@ -90,7 +90,7 @@ public class TorrentsTest
var fileSystemMock = new MockFileSystem(new Dictionary<String, MockFileData> var fileSystemMock = new MockFileSystem(new Dictionary<String, MockFileData>
{ {
{ {
filePath, new MockFileData("Test file") filePath, new("Test file")
}, },
}); });
@ -134,7 +134,7 @@ public class TorrentsTest
// Arrange // Arrange
var settings = new DbSettings() var settings = new DbSettings()
{ {
General = new DbSettingsGeneral() General = new()
{ {
RunOnTorrentCompleteFileName = null RunOnTorrentCompleteFileName = null
} }
@ -152,7 +152,7 @@ public class TorrentsTest
var fileSystemMock = new MockFileSystem(new Dictionary<String, MockFileData> var fileSystemMock = new MockFileSystem(new Dictionary<String, MockFileData>
{ {
{ {
filePath, new MockFileData("Test file") filePath, new("Test file")
}, },
}); });
@ -181,7 +181,7 @@ public class TorrentsTest
// Arrange // Arrange
var settings = new DbSettings() var settings = new DbSettings()
{ {
General = new DbSettingsGeneral() General = new()
{ {
RunOnTorrentCompleteFileName = "/bin/echo" RunOnTorrentCompleteFileName = "/bin/echo"
} }
@ -199,7 +199,7 @@ public class TorrentsTest
var fileSystemMock = new MockFileSystem(new Dictionary<String, MockFileData> var fileSystemMock = new MockFileSystem(new Dictionary<String, MockFileData>
{ {
{ {
filePath, new MockFileData("Test file") filePath, new("Test file")
}, },
}); });
@ -247,7 +247,7 @@ public class TorrentsTest
// Arrange // Arrange
var settings = new DbSettings() var settings = new DbSettings()
{ {
General = new DbSettingsGeneral() General = new()
{ {
RunOnTorrentCompleteFileName = "/bin/echo" RunOnTorrentCompleteFileName = "/bin/echo"
} }
@ -265,7 +265,7 @@ public class TorrentsTest
var fileSystemMock = new MockFileSystem(new Dictionary<String, MockFileData> var fileSystemMock = new MockFileSystem(new Dictionary<String, MockFileData>
{ {
{ {
filePath, new MockFileData("Test file") filePath, new("Test file")
}, },
}); });

View file

@ -18,13 +18,14 @@
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.2.0" /> <PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.2.0" />
<PackageReference Include="MonoTorrent" Version="3.0.2" /> <PackageReference Include="MonoTorrent" Version="3.0.2" />
<PackageReference Include="Polly" Version="8.5.2" /> <PackageReference Include="Polly" Version="8.5.2" />
<PackageReference Include="Premiumize.NET" Version="1.0.4" /> <PackageReference Include="Premiumize.NET" Version="1.0.9" />
<PackageReference Include="RD.NET" Version="2.1.6" /> <PackageReference Include="RD.NET" Version="2.1.7" />
<PackageReference Include="Serilog" Version="4.2.0" /> <PackageReference Include="Serilog" Version="4.2.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" /> <PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="SharpCompress" Version="0.39.0" /> <PackageReference Include="SharpCompress" Version="0.39.0" />
<PackageReference Include="Synology.Api.Client" Version="0.3.87" /> <PackageReference Include="Synology.Api.Client" Version="0.3.91" />
<PackageReference Include="TestableIO.System.IO.Abstractions" Version="21.3.1" /> <PackageReference Include="TestableIO.System.IO.Abstractions" Version="22.0.10" />
<PackageReference Include="TestableIO.System.IO.Abstractions.Wrappers" Version="22.0.10" />
<PackageReference Include="TorBox.NET" Version="1.4.0" /> <PackageReference Include="TorBox.NET" Version="1.4.0" />
</ItemGroup> </ItemGroup>