mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 04:34:18 +01:00
Replace != null with is not null
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Jellyfin.Api.Tests
|
||||
user.SetPermission(PermissionKind.IsAdministrator, role.Equals(UserRoles.Administrator, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
// Add access schedules if set.
|
||||
if (accessSchedules != null)
|
||||
if (accessSchedules is not null)
|
||||
{
|
||||
foreach (var accessSchedule in accessSchedules)
|
||||
{
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace Jellyfin.Model.Tests
|
||||
var val = builder.BuildVideoItem(options);
|
||||
Assert.NotNull(val);
|
||||
|
||||
if (playMethod != null)
|
||||
if (playMethod is not null)
|
||||
{
|
||||
Assert.Equal(playMethod, val.PlayMethod);
|
||||
}
|
||||
@@ -490,7 +490,7 @@ namespace Jellyfin.Model.Tests
|
||||
using (var stream = File.OpenRead(path))
|
||||
{
|
||||
var value = await JsonSerializer.DeserializeAsync<T>(stream, JsonDefaults.Options);
|
||||
if (value != null)
|
||||
if (value is not null)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Jellyfin.Naming.Tests.TV
|
||||
{
|
||||
var result = SeasonPathParser.Parse(path, true, true);
|
||||
|
||||
Assert.Equal(result.SeasonNumber != null, result.Success);
|
||||
Assert.Equal(result.SeasonNumber is not null, result.Success);
|
||||
Assert.Equal(result.SeasonNumber, seasonNumber);
|
||||
Assert.Equal(isSeasonDirectory, result.IsSeasonFolder);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Jellyfin.Naming.Tests.Video
|
||||
_namingOptions).ToList();
|
||||
|
||||
Assert.Single(result.Where(v => v.ExtraType is null));
|
||||
Assert.Single(result.Where(v => v.ExtraType != null));
|
||||
Assert.Single(result.Where(v => v.ExtraType is not null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -45,7 +45,7 @@ namespace Jellyfin.Naming.Tests.Video
|
||||
_namingOptions).ToList();
|
||||
|
||||
Assert.Single(result.Where(v => v.ExtraType is null));
|
||||
Assert.Single(result.Where(v => v.ExtraType != null));
|
||||
Assert.Single(result.Where(v => v.ExtraType is not null));
|
||||
Assert.Equal(2, result[0].AlternateVersions.Count);
|
||||
}
|
||||
|
||||
|
||||
@@ -332,7 +332,7 @@ namespace Jellyfin.Networking.Tests
|
||||
// Check to see if dns resolution is working. If not, skip test.
|
||||
_ = IPHost.TryParse(source, out var host);
|
||||
|
||||
if (resultObj != null && host?.HasAddress == true)
|
||||
if (resultObj is not null && host?.HasAddress == true)
|
||||
{
|
||||
result = ((IPNetAddress)resultObj[0]).ToString(true);
|
||||
var intf = nm.GetBindInterface(source, out _);
|
||||
@@ -390,7 +390,7 @@ namespace Jellyfin.Networking.Tests
|
||||
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
|
||||
NetworkManager.MockNetworkSettings = string.Empty;
|
||||
|
||||
if (nm.TryParseInterface(result, out Collection<IPObject>? resultObj) && resultObj != null)
|
||||
if (nm.TryParseInterface(result, out Collection<IPObject>? resultObj) && resultObj is not null)
|
||||
{
|
||||
// Parse out IPAddresses so we can do a string comparison. (Ignore subnet masks).
|
||||
result = ((IPNetAddress)resultObj[0]).ToString(true);
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
||||
|
||||
// Use type Series to hit DisplayOrder
|
||||
Assert.False(TestMergeBaseItemData<Series, SeriesInfo>(propName, oldValue, newValue, null, false, out _));
|
||||
if (lockField != null)
|
||||
if (lockField is not null)
|
||||
{
|
||||
Assert.False(TestMergeBaseItemData<Series, SeriesInfo>(propName, oldValue, newValue, lockField, true, out _));
|
||||
Assert.False(TestMergeBaseItemData<Series, SeriesInfo>(propName, null, newValue, lockField, false, out _));
|
||||
@@ -120,7 +120,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
||||
|
||||
// Use type Audio to hit AlbumArtists
|
||||
Assert.False(TestMergeBaseItemData<Audio, SongInfo>(propName, oldValue, newValue, null, false, out _));
|
||||
if (lockField != null)
|
||||
if (lockField is not null)
|
||||
{
|
||||
Assert.False(TestMergeBaseItemData<Audio, SongInfo>(propName, oldValue, newValue, lockField, true, out _));
|
||||
Assert.False(TestMergeBaseItemData<Audio, SongInfo>(propName, Array.Empty<string>(), newValue, lockField, false, out _));
|
||||
|
||||
@@ -423,7 +423,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
||||
where TProviderType : class, IImageProvider
|
||||
{
|
||||
Mock<IHasOrder>? hasOrder = null;
|
||||
if (order != null)
|
||||
if (order is not null)
|
||||
{
|
||||
hasOrder = new Mock<IHasOrder>(MockBehavior.Strict);
|
||||
hasOrder.Setup(i => i.Order)
|
||||
@@ -471,7 +471,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
||||
}
|
||||
|
||||
Mock<IHasOrder>? hasOrder = null;
|
||||
if (order != null)
|
||||
if (order is not null)
|
||||
{
|
||||
hasOrder = forcedProvider is null ? new Mock<IHasOrder>() : forcedProvider.As<IHasOrder>();
|
||||
hasOrder.Setup(i => i.Order)
|
||||
@@ -499,7 +499,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
||||
};
|
||||
|
||||
// only create type options if populating it with something
|
||||
if (imageFetcherOrder != null || metadataFetcherOrder != null)
|
||||
if (imageFetcherOrder is not null || metadataFetcherOrder is not null)
|
||||
{
|
||||
imageFetcherOrder ??= Array.Empty<string>();
|
||||
metadataFetcherOrder ??= Array.Empty<string>();
|
||||
@@ -527,7 +527,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
||||
var serverConfiguration = new ServerConfiguration();
|
||||
|
||||
// only create type options if populating it with something
|
||||
if (imageFetcherOrder != null || localMetadataReaderOrder != null || metadataFetcherOrder != null)
|
||||
if (imageFetcherOrder is not null || localMetadataReaderOrder is not null || metadataFetcherOrder is not null)
|
||||
{
|
||||
imageFetcherOrder ??= Array.Empty<string>();
|
||||
localMetadataReaderOrder ??= Array.Empty<string>();
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
|
||||
private static IMediaSourceManager GetMediaSourceManager(Video item, MediaStream? defaultStream, List<MediaStream> mediaStreams)
|
||||
{
|
||||
var defaultStreamList = new List<MediaStream>();
|
||||
if (defaultStream != null)
|
||||
if (defaultStream is not null)
|
||||
{
|
||||
defaultStreamList.Add(defaultStream);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
|
||||
{
|
||||
return new ContentResult()
|
||||
{
|
||||
Content = (@params != null && @params.Count > 0)
|
||||
Content = (@params is not null && @params.Count > 0)
|
||||
? string.Join("&", @params.Select(x => x.Key + "=" + x.Value))
|
||||
: string.Empty,
|
||||
ContentType = "text/plain; charset=utf-8",
|
||||
@@ -42,7 +42,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
|
||||
{
|
||||
return new ContentResult()
|
||||
{
|
||||
Content = (@params != null && @params.Count > 0)
|
||||
Content = (@params is not null && @params.Count > 0)
|
||||
? string.Join("&", @params.Select(x => x.Key + "=" + string.Join(',', x.Value)))
|
||||
: string.Empty,
|
||||
ContentType = "text/plain; charset=utf-8",
|
||||
|
||||
Reference in New Issue
Block a user