mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-04 18:09:12 +03:00
[PR #2850] [CLOSED] Fix warnings in Jellyfin.Naming.Tests #9249
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/2850
Author: @dtparr
Created: 4/13/2020
Status: ❌ Closed
Base:
master← Head:namingTestsWarnings📝 Commits (2)
8d0f29dFix warnings in Jellyfin.Naming.Tests1d894fdFix comment spacing per review📊 Changes
10 files changed (+54 additions, -21 deletions)
View changed files
📝
tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs(+1 -1)📝
tests/Jellyfin.Naming.Tests/TV/AbsoluteEpisodeNumberTests.cs(+2 -1)📝
tests/Jellyfin.Naming.Tests/TV/DailyEpisodeTests.cs(+7 -6)📝
tests/Jellyfin.Naming.Tests/TV/EpisodeNumberWithoutSeasonTests.cs(+2 -1)📝
tests/Jellyfin.Naming.Tests/TV/EpisodeWithoutSeasonTests.cs(+4 -3)📝
tests/Jellyfin.Naming.Tests/TV/SeasonNumberTests.cs(+2 -1)📝
tests/Jellyfin.Naming.Tests/TV/SimpleEpisodeTests.cs(+4 -3)📝
tests/Jellyfin.Naming.Tests/Video/Format3DTests.cs(+4 -3)📝
tests/Jellyfin.Naming.Tests/Video/StubTests.cs(+3 -2)📝
tests/Jellyfin.Naming.Tests/Video/VideoResolverTests.cs(+25 -0)📄 Description
This PR removes all the warnings in Jellyfin.Naming.Tests other than the ones related to not marking methods as [Fact] (I tested a couple of those, and they did indeed fail when [Fact] was uncommented, so there are presumably fixes to the naming functionality required to get those warnings to go away).
Changes
Most of the issues revolved around potential nulls. I added Assert.NotNull's in those places to protect against a bare null dereference. Unfortuantely, while the Xunit has code on master to have anything passed into an Assert.NotNull treated as not nullable afterwards, that version of Xunit has not been released yet, so that doesn't satisfy the compiler. For cases where there were only a handful of these per test class, I simply tagged the object with ! (e.g. result!.foo) thereafter, and those can be removed in the long run. For one test class that had several dozen cases, I created a utility method to wrap the Xunit Assert.NotNull with an annotated method to satisfy the compiler without the need for all the !'s splashed from place to place.
Issues
This is related to #2149, although it will not resolve the Jellyfin.Naming.Tests entirely due to the above.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.