The Free Software Media System - Server Backend & API
Enable TreatWarningsAsErrors and Nullable for test projects
Bond_00971abf1d3ce91
diff --git a/MediaBrowser.Controller/Net/IAuthService.cs b/MediaBrowser.Controller/Net/IAuthService.csindex 4c9120e0c9..9132404a08 100644--- a/MediaBrowser.Controller/Net/IAuthService.cs+++ b/MediaBrowser.Controller/Net/IAuthService.cs@@ -1,3 +1,5 @@+#nullable enable+using MediaBrowser.Controller.Entities;using MediaBrowser.Model.Services;using Microsoft.AspNetCore.Http;@@ -7,6 +9,6 @@ namespace MediaBrowser.Controller.Netpublic interface IAuthService{void Authenticate(IRequest request, IAuthenticationAttributes authAttribtues);- User Authenticate(HttpRequest request, IAuthenticationAttributes authAttribtues);+ User? Authenticate(HttpRequest request, IAuthenticationAttributes authAttribtues);}}diff --git a/tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.cs b/tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.csindex a2f5c25016..3b3d03c8b7 100644--- a/tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.cs+++ b/tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.cs@@ -83,7 +83,7 @@ namespace Jellyfin.Api.Tests.Autha => a.Authenticate(It.IsAny<HttpRequest>(),It.IsAny<AuthenticatedAttribute>()))- .Returns((User)null);+ .Returns((User?)null);var authenticateResult = await _sut.AuthenticateAsync();diff --git a/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csprojindex 0e8ef135ef..1d7e4f7af3 100644--- a/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj+++ b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj@@ -3,6 +3,8 @@<PropertyGroup><TargetFramework>netcoreapp3.1</TargetFramework><IsPackable>false</IsPackable>+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>+ <Nullable>enable</Nullable></PropertyGroup><ItemGroup>diff --git a/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj b/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csprojindex da5e6576d3..86bb11bd4c 100644--- a/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj+++ b/tests/Jellyfin.Common.Tests/Jellyfin.Common.Tests.csproj@@ -3,6 +3,8 @@<PropertyGroup><TargetFramework>netcoreapp3.1</TargetFramework><IsPackable>false</IsPackable>+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>+ <Nullable>enable</Nullable></PropertyGroup><ItemGroup>diff --git a/tests/Jellyfin.MediaEncoding.Tests/EncoderValidatorTests.cs b/tests/Jellyfin.MediaEncoding.Tests/EncoderValidatorTests.csindex a7848316e7..e0f1f236c7 100644--- a/tests/Jellyfin.MediaEncoding.Tests/EncoderValidatorTests.cs+++ b/tests/Jellyfin.MediaEncoding.Tests/EncoderValidatorTests.cs@@ -9,15 +9,15 @@ namespace Jellyfin.MediaEncoding.Tests{public class EncoderValidatorTests{- private class GetFFmpegVersionTestData : IEnumerable<object[]>+ private class GetFFmpegVersionTestData : IEnumerable<object?[]>{- public IEnumerator<object[]> GetEnumerator()+ public IEnumerator<object?[]> GetEnumerator(){- yield return new object[] { EncoderValidatorTestsData.FFmpegV421Output, new Version(4, 2, 1) };- yield return new object[] { EncoderValidatorTestsData.FFmpegV42Output, new Version(4, 2) };- yield return new object[] { EncoderValidatorTestsData.FFmpegV414Output, new Version(4, 1, 4) };- yield return new object[] { EncoderValidatorTestsData.FFmpegV404Output, new Version(4, 0, 4) };- yield return new object[] { EncoderValidatorTestsData.FFmpegGitUnknownOutput, null };+ yield return new object?[] { EncoderValidatorTestsData.FFmpegV421Output, new Version(4, 2, 1) };+ yield return new object?[] { EncoderValidatorTestsData.FFmpegV42Output, new Version(4, 2) };+ yield return new object?[] { EncoderValidatorTestsData.FFmpegV414Output, new Version(4, 1, 4) };+ yield return new object?[] { EncoderValidatorTestsData.FFmpegV404Output, new Version(4, 0, 4) };+ yield return new object?[] { EncoderValidatorTestsData.FFmpegGitUnknownOutput, null };}IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();@@ -25,7 +25,7 @@ namespace Jellyfin.MediaEncoding.Tests[Theory][ClassData(typeof(GetFFmpegVersionTestData))]- public void GetFFmpegVersionTest(string versionOutput, Version version)+ public void GetFFmpegVersionTest(string versionOutput, Version? version){Assert.Equal(version, EncoderValidator.GetFFmpegVersion(versionOutput));}diff --git a/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj b/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csprojindex c01edd9fed..b5e4a1287b 100644--- a/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj+++ b/tests/Jellyfin.MediaEncoding.Tests/Jellyfin.MediaEncoding.Tests.csproj@@ -3,6 +3,8 @@<PropertyGroup><TargetFramework>netcoreapp3.1</TargetFramework><IsPackable>false</IsPackable>+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>+ <Nullable>enable</Nullable></PropertyGroup><ItemGroup>diff --git a/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj b/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csprojindex f246d459ba..ebc1a54590 100644--- a/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj+++ b/tests/Jellyfin.Naming.Tests/Jellyfin.Naming.Tests.csproj@@ -3,6 +3,8 @@<PropertyGroup><TargetFramework>netcoreapp3.1</TargetFramework><IsPackable>false</IsPackable>+ <!-- TODO: <TreatWarningsAsErrors>true</TreatWarningsAsErrors> -->+ <Nullable>enable</Nullable></PropertyGroup><ItemGroup>diff --git a/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj b/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csprojindex c554bc9372..29733a1c47 100644--- a/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj+++ b/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj@@ -3,6 +3,8 @@<PropertyGroup><TargetFramework>netcoreapp3.1</TargetFramework><IsPackable>false</IsPackable>+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>+ <Nullable>enable</Nullable><RootNamespace>Jellyfin.Server.Implementations.Tests</RootNamespace></PropertyGroup>