The Free Software Media System - Server Backend & API
Add code analyzers to Jellyfin.Naming.Tests and fix resulting warnings
aled3ff6e3ff6520
diff --git a/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj b/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csprojindex ac0c970c13..8b14cf800d 100644--- a/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj+++ b/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj@@ -1,4 +1,4 @@-<Project Sdk="Microsoft.NET.Sdk">+<Project Sdk="Microsoft.NET.Sdk"><!-- ProjectGuid is only included as a requirement for SonarQube analysis --><PropertyGroup>@@ -21,5 +21,15 @@<ItemGroup><ProjectReference Include="..\..\Emby.Naming\Emby.Naming.csproj" /></ItemGroup>++ <!-- Code Analyzers-->+ <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">+ <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />+ <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />+ </ItemGroup>++ <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">+ <CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet>+ </PropertyGroup></Project>diff --git a/tests/Jellyfin.Naming.Tests/TV/DailyEpisodeTests.cs b/tests/Jellyfin.Naming.Tests/TV/DailyEpisodeTests.csindex 8e58b9243a..2937914b9f 100644--- a/tests/Jellyfin.Naming.Tests/TV/DailyEpisodeTests.cs+++ b/tests/Jellyfin.Naming.Tests/TV/DailyEpisodeTests.cs@@ -6,8 +6,6 @@ namespace Jellyfin.Naming.Tests.TV{public class DailyEpisodeTests{--[Theory][InlineData(@"/server/anything_1996.11.14.mp4", "anything", 1996, 11, 14)][InlineData(@"/server/anything_1996-11-14.mp4", "anything", 1996, 11, 14)]diff --git a/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberWithoutSeasonTests.cs b/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberWithoutSeasonTests.csindex e8348f6fe1..8bd1a43d62 100644--- a/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberWithoutSeasonTests.cs+++ b/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberWithoutSeasonTests.cs@@ -6,7 +6,6 @@ namespace Jellyfin.Naming.Tests.TV{public class EpisodeNumberWithoutSeasonTests{-[Theory][InlineData(8, @"The Simpsons/The Simpsons.S25E08.Steal this episode.mp4")][InlineData(2, @"The Simpsons/The Simpsons - 02 - Ep Name.avi")]diff --git a/tests/Jellyfin.Naming.Tests/TV/EpisodePathParserTest.cs b/tests/Jellyfin.Naming.Tests/TV/EpisodePathParserTest.csindex 4b56067153..03aeb7f76b 100644--- a/tests/Jellyfin.Naming.Tests/TV/EpisodePathParserTest.cs+++ b/tests/Jellyfin.Naming.Tests/TV/EpisodePathParserTest.cs@@ -1,4 +1,4 @@-using Emby.Naming.Common;+using Emby.Naming.Common;using Emby.Naming.TV;using Xunit;@@ -35,7 +35,6 @@ namespace Jellyfin.Naming.Tests.TV// TODO: [InlineData("Watchmen (2019)/Watchmen 1x03 [WEBDL-720p][EAC3 5.1][h264][-TBS] - She Was Killed by Space Junk.mkv", "Watchmen (2019)", 1, 3)]// TODO: [InlineData("/The.Legend.of.Condor.Heroes.2017.V2.web-dl.1080p.h264.aac-hdctv/The.Legend.of.Condor.Heroes.2017.E07.V2.web-dl.1080p.h264.aac-hdctv.mkv", "The Legend of Condor Heroes 2017", 1, 7)]public void ParseEpisodesCorrectly(string path, string name, int season, int episode)-{NamingOptions o = new NamingOptions();EpisodePathParser p = new EpisodePathParser(o);diff --git a/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs b/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.csindex 4b1ab6c883..4198d69ff8 100644--- a/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs+++ b/tests/Jellyfin.Naming.Tests/Video/MultiVersionTests.cs@@ -28,7 +28,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -53,7 +52,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -76,7 +74,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -104,7 +101,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Equal(7, result.Count);@@ -134,7 +130,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -165,7 +160,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Equal(9, result.Count);@@ -192,7 +186,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Equal(5, result.Count);@@ -221,7 +214,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Equal(5, result.Count);@@ -251,7 +243,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -284,7 +275,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -311,7 +301,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Equal(2, result.Count);@@ -340,7 +329,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -372,7 +360,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Equal(5, result.Count);@@ -396,7 +383,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -422,7 +408,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);diff --git a/tests/Jellyfin.Naming.Tests/Video/StackTests.cs b/tests/Jellyfin.Naming.Tests/Video/StackTests.csindex 3630a07e46..8794d3ebe8 100644--- a/tests/Jellyfin.Naming.Tests/Video/StackTests.cs+++ b/tests/Jellyfin.Naming.Tests/Video/StackTests.cs@@ -368,11 +368,11 @@ namespace Jellyfin.Naming.Tests.Video{var files = new[]{- new FileSystemMetadata{FullName = "Bad Boys (2006) part1.mkv", IsDirectory = false},- new FileSystemMetadata{FullName = "Bad Boys (2006) part2.mkv", IsDirectory = false},- new FileSystemMetadata{FullName = "300 (2006) part2", IsDirectory = true},- new FileSystemMetadata{FullName = "300 (2006) part3", IsDirectory = true},- new FileSystemMetadata{FullName = "300 (2006) part1", IsDirectory = true}+ new FileSystemMetadata { FullName = "Bad Boys (2006) part1.mkv", IsDirectory = false },+ new FileSystemMetadata { FullName = "Bad Boys (2006) part2.mkv", IsDirectory = false },+ new FileSystemMetadata { FullName = "300 (2006) part2", IsDirectory = true },+ new FileSystemMetadata { FullName = "300 (2006) part3", IsDirectory = true },+ new FileSystemMetadata { FullName = "300 (2006) part1", IsDirectory = true }};var resolver = GetResolver();diff --git a/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs b/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.csindex 4832d1593d..12c4a50fe3 100644--- a/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs+++ b/tests/Jellyfin.Naming.Tests/Video/VideoListResolverTests.cs@@ -9,6 +9,7 @@ namespace Jellyfin.Naming.Tests.Videopublic class VideoListResolverTests{private readonly NamingOptions _namingOptions = new NamingOptions();+// FIXME// [Fact]private void TestStackAndExtras()@@ -45,7 +46,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Equal(5, result.Count);@@ -74,7 +74,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -95,7 +94,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -116,7 +114,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -138,7 +135,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -159,7 +155,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -184,7 +179,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Equal(5, result.Count);@@ -205,7 +199,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = true,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -227,7 +220,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = true,FullName = i-}).ToList()).ToList();Assert.Equal(2, result.Count);@@ -249,7 +241,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -271,7 +262,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -294,7 +284,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -317,7 +306,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Equal(2, result.Count);@@ -337,7 +325,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -357,7 +344,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -378,7 +364,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -399,7 +384,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);@@ -422,7 +406,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Equal(4, result.Count);@@ -443,7 +426,6 @@ namespace Jellyfin.Naming.Tests.Video{IsDirectory = false,FullName = i-}).ToList()).ToList();Assert.Single(result);diff --git a/tests/Jellyfin.Naming.Tests/Video/VideoResolverTests.cs b/tests/Jellyfin.Naming.Tests/Video/VideoResolverTests.csindex a901c54702..99828b2eb7 100644--- a/tests/Jellyfin.Naming.Tests/Video/VideoResolverTests.cs+++ b/tests/Jellyfin.Naming.Tests/Video/VideoResolverTests.cs@@ -176,7 +176,6 @@ namespace Jellyfin.Naming.Tests.Video};}-[Theory][MemberData(nameof(GetResolveFileTestData))]public void ResolveFile_ValidFileName_Success(VideoFileInfo expectedResult)