mirror of https://github.com/Radarr/Radarr
Fixed: Avoid zero-length array memory allocations
This commit is contained in:
parent
295b975046
commit
4ec71538b9
|
@ -190,8 +190,6 @@ dotnet_diagnostic.CA1821.severity = suggestion
|
||||||
dotnet_diagnostic.CA1822.severity = suggestion
|
dotnet_diagnostic.CA1822.severity = suggestion
|
||||||
dotnet_diagnostic.CA1823.severity = suggestion
|
dotnet_diagnostic.CA1823.severity = suggestion
|
||||||
dotnet_diagnostic.CA1824.severity = suggestion
|
dotnet_diagnostic.CA1824.severity = suggestion
|
||||||
dotnet_diagnostic.CA1825.severity = suggestion
|
|
||||||
dotnet_diagnostic.CA1826.severity = suggestion
|
|
||||||
dotnet_diagnostic.CA2000.severity = suggestion
|
dotnet_diagnostic.CA2000.severity = suggestion
|
||||||
dotnet_diagnostic.CA2002.severity = suggestion
|
dotnet_diagnostic.CA2002.severity = suggestion
|
||||||
dotnet_diagnostic.CA2007.severity = suggestion
|
dotnet_diagnostic.CA2007.severity = suggestion
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Nancy;
|
using Nancy;
|
||||||
|
@ -57,7 +58,7 @@ namespace NzbDrone.Api.FileSystem
|
||||||
|
|
||||||
if (!_diskProvider.FolderExists(path))
|
if (!_diskProvider.FolderExists(path))
|
||||||
{
|
{
|
||||||
return new string[0];
|
return Array.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _diskScanService.GetVideoFiles(path).Select(f => new
|
return _diskScanService.GetVideoFiles(path).Select(f => new
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
@ -11,7 +12,7 @@ namespace NzbDrone.Common.Test.EnvironmentTests
|
||||||
[Test]
|
[Test]
|
||||||
public void empty_array_should_return_empty_flags()
|
public void empty_array_should_return_empty_flags()
|
||||||
{
|
{
|
||||||
var args = new StartupContext(new string[0]);
|
var args = new StartupContext(Array.Empty<string>());
|
||||||
args.Flags.Should().BeEmpty();
|
args.Flags.Should().BeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace NzbDrone.Common.Test.Http
|
||||||
Mocker.SetConstant<ICacheManager>(Mocker.Resolve<CacheManager>());
|
Mocker.SetConstant<ICacheManager>(Mocker.Resolve<CacheManager>());
|
||||||
Mocker.SetConstant<ICreateManagedWebProxy>(Mocker.Resolve<ManagedWebProxyFactory>());
|
Mocker.SetConstant<ICreateManagedWebProxy>(Mocker.Resolve<ManagedWebProxyFactory>());
|
||||||
Mocker.SetConstant<IRateLimitService>(Mocker.Resolve<RateLimitService>());
|
Mocker.SetConstant<IRateLimitService>(Mocker.Resolve<RateLimitService>());
|
||||||
Mocker.SetConstant<IEnumerable<IHttpRequestInterceptor>>(new IHttpRequestInterceptor[0]);
|
Mocker.SetConstant<IEnumerable<IHttpRequestInterceptor>>(Array.Empty<IHttpRequestInterceptor>());
|
||||||
Mocker.SetConstant<IHttpDispatcher>(Mocker.Resolve<TDispatcher>());
|
Mocker.SetConstant<IHttpDispatcher>(Mocker.Resolve<TDispatcher>());
|
||||||
|
|
||||||
// Used for manual testing of socks proxies.
|
// Used for manual testing of socks proxies.
|
||||||
|
@ -352,7 +352,7 @@ namespace NzbDrone.Common.Test.Http
|
||||||
var oldRequest = new HttpRequest($"https://{_httpBinHost2}/get");
|
var oldRequest = new HttpRequest($"https://{_httpBinHost2}/get");
|
||||||
oldRequest.Cookies["my"] = "cookie";
|
oldRequest.Cookies["my"] = "cookie";
|
||||||
|
|
||||||
var oldClient = new HttpClient(new IHttpRequestInterceptor[0], Mocker.Resolve<ICacheManager>(), Mocker.Resolve<IRateLimitService>(), Mocker.Resolve<IHttpDispatcher>(), Mocker.Resolve<Logger>());
|
var oldClient = new HttpClient(Array.Empty<IHttpRequestInterceptor>(), Mocker.Resolve<ICacheManager>(), Mocker.Resolve<IRateLimitService>(), Mocker.Resolve<IHttpDispatcher>(), Mocker.Resolve<Logger>());
|
||||||
|
|
||||||
oldClient.Should().NotBeSameAs(Subject);
|
oldClient.Should().NotBeSameAs(Subject);
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace NzbDrone.Common.Http
|
||||||
|
|
||||||
public string[] GetCookieHeaders()
|
public string[] GetCookieHeaders()
|
||||||
{
|
{
|
||||||
return Headers.GetValues("Set-Cookie") ?? new string[0];
|
return Headers.GetValues("Set-Cookie") ?? Array.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<string, string> GetCookies()
|
public Dictionary<string, string> GetCookies()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using NzbDrone.Common.Extensions;
|
using System;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
|
|
||||||
namespace NzbDrone.Common.Http.Proxy
|
namespace NzbDrone.Common.Http.Proxy
|
||||||
{
|
{
|
||||||
|
@ -41,7 +42,7 @@ namespace NzbDrone.Common.Http.Proxy
|
||||||
return hostlist;
|
return hostlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new string[] { };
|
return Array.Empty<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -298,11 +298,11 @@ namespace TinyIoC
|
||||||
}
|
}
|
||||||
catch (System.IO.FileNotFoundException)
|
catch (System.IO.FileNotFoundException)
|
||||||
{
|
{
|
||||||
assemblies = new Type[] { };
|
assemblies = Array.Empty<Type>();
|
||||||
}
|
}
|
||||||
catch (NotSupportedException)
|
catch (NotSupportedException)
|
||||||
{
|
{
|
||||||
assemblies = new Type[] { };
|
assemblies = Array.Empty<Type>();
|
||||||
}
|
}
|
||||||
#if !NETFX_CORE
|
#if !NETFX_CORE
|
||||||
catch (ReflectionTypeLoadException e)
|
catch (ReflectionTypeLoadException e)
|
||||||
|
@ -3355,7 +3355,7 @@ namespace TinyIoC
|
||||||
//#if NETFX_CORE
|
//#if NETFX_CORE
|
||||||
// MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => !mi.GetParameters().Any());
|
// MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => !mi.GetParameters().Any());
|
||||||
//#else
|
//#else
|
||||||
MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { });
|
MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", Array.Empty<Type>());
|
||||||
|
|
||||||
//#endif
|
//#endif
|
||||||
resolveMethod = resolveMethod.MakeGenericMethod(returnType);
|
resolveMethod = resolveMethod.MakeGenericMethod(returnType);
|
||||||
|
@ -3648,7 +3648,7 @@ namespace TinyIoC
|
||||||
private IEnumerable<TypeRegistration> GetParentRegistrationsForType(Type resolveType)
|
private IEnumerable<TypeRegistration> GetParentRegistrationsForType(Type resolveType)
|
||||||
{
|
{
|
||||||
if (_Parent == null)
|
if (_Parent == null)
|
||||||
return new TypeRegistration[] { };
|
return Array.Empty<TypeRegistration>();
|
||||||
|
|
||||||
var registrations = _Parent._RegisteredTypes.Keys.Where(tr => tr.Type == resolveType);
|
var registrations = _Parent._RegisteredTypes.Keys.Where(tr => tr.Type == resolveType);
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
|
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GivenFailedDownload()
|
protected void GivenFailedDownload()
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
|
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
|
||||||
|
|
||||||
Mocker.GetMock<IRemotePathMappingService>()
|
Mocker.GetMock<IRemotePathMappingService>()
|
||||||
.Setup(v => v.RemapRemoteToLocal(It.IsAny<string>(), It.IsAny<OsPath>()))
|
.Setup(v => v.RemapRemoteToLocal(It.IsAny<string>(), It.IsAny<OsPath>()))
|
||||||
|
|
|
@ -278,7 +278,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
|
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
|
||||||
|
|
||||||
_downloadStationConfigItems = new Dictionary<string, object>
|
_downloadStationConfigItems = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
|
|
|
@ -170,7 +170,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
|
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
|
||||||
|
|
||||||
_downloadStationConfigItems = new Dictionary<string, object>
|
_downloadStationConfigItems = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.HadoukenTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
|
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GivenFailedDownload()
|
protected void GivenFailedDownload()
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
|
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
|
||||||
|
|
||||||
Mocker.GetMock<IQBittorrentProxy>()
|
Mocker.GetMock<IQBittorrentProxy>()
|
||||||
.Setup(s => s.GetConfig(It.IsAny<QBittorrentSettings>()))
|
.Setup(s => s.GetConfig(It.IsAny<QBittorrentSettings>()))
|
||||||
|
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.SeeOther));
|
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, Array.Empty<byte>(), System.Net.HttpStatusCode.SeeOther));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GivenRedirectToTorrent()
|
protected void GivenRedirectToTorrent()
|
||||||
|
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.FullUri == _downloadUrl)))
|
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.FullUri == _downloadUrl)))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.Found));
|
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, Array.Empty<byte>(), System.Net.HttpStatusCode.Found));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GivenFailedDownload()
|
protected void GivenFailedDownload()
|
||||||
|
@ -355,7 +355,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||||
|
|
||||||
Mocker.GetMock<IQBittorrentProxy>()
|
Mocker.GetMock<IQBittorrentProxy>()
|
||||||
.Setup(v => v.MoveTorrentToTopInQueue(It.IsAny<string>(), It.IsAny<QBittorrentSettings>()))
|
.Setup(v => v.MoveTorrentToTopInQueue(It.IsAny<string>(), It.IsAny<QBittorrentSettings>()))
|
||||||
.Throws(new HttpException(new HttpResponse(new HttpRequest("http://me.local/"), new HttpHeader(), new byte[0], System.Net.HttpStatusCode.Forbidden)));
|
.Throws(new HttpException(new HttpResponse(new HttpRequest("http://me.local/"), new HttpHeader(), Array.Empty<byte>(), System.Net.HttpStatusCode.Forbidden)));
|
||||||
|
|
||||||
var remoteMovie = CreateRemoteMovie();
|
var remoteMovie = CreateRemoteMovie();
|
||||||
|
|
||||||
|
|
|
@ -537,7 +537,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||||
public void should_test_failed_if_tv_sorting_empty()
|
public void should_test_failed_if_tv_sorting_empty()
|
||||||
{
|
{
|
||||||
_config.Misc.enable_tv_sorting = true;
|
_config.Misc.enable_tv_sorting = true;
|
||||||
_config.Misc.tv_categories = new string[0];
|
_config.Misc.tv_categories = Array.Empty<string>();
|
||||||
|
|
||||||
var result = new NzbDroneValidationResult(Subject.Test());
|
var result = new NzbDroneValidationResult(Subject.Test());
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
|
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
|
||||||
|
|
||||||
_transmissionConfigItems = new Dictionary<string, object>();
|
_transmissionConfigItems = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
|
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Array.Empty<byte>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GivenRedirectToMagnet()
|
protected void GivenRedirectToMagnet()
|
||||||
|
@ -101,7 +101,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.SeeOther));
|
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, Array.Empty<byte>(), System.Net.HttpStatusCode.SeeOther));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GivenRedirectToTorrent()
|
protected void GivenRedirectToTorrent()
|
||||||
|
@ -111,7 +111,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.ToString() == _downloadUrl)))
|
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.ToString() == _downloadUrl)))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.Found));
|
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, Array.Empty<byte>(), System.Net.HttpStatusCode.Found));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GivenFailedDownload()
|
protected void GivenFailedDownload()
|
||||||
|
|
|
@ -123,7 +123,7 @@ namespace NzbDrone.Core.Test.Download
|
||||||
public void Download_report_should_trigger_indexer_backoff_on_http429_with_long_time()
|
public void Download_report_should_trigger_indexer_backoff_on_http429_with_long_time()
|
||||||
{
|
{
|
||||||
var request = new HttpRequest("http://my.indexer.com");
|
var request = new HttpRequest("http://my.indexer.com");
|
||||||
var response = new HttpResponse(request, new HttpHeader(), new byte[0], (HttpStatusCode)429);
|
var response = new HttpResponse(request, new HttpHeader(), Array.Empty<byte>(), (HttpStatusCode)429);
|
||||||
response.Headers["Retry-After"] = "300";
|
response.Headers["Retry-After"] = "300";
|
||||||
|
|
||||||
var mock = WithUsenetClient();
|
var mock = WithUsenetClient();
|
||||||
|
@ -143,7 +143,7 @@ namespace NzbDrone.Core.Test.Download
|
||||||
public void Download_report_should_trigger_indexer_backoff_on_http429_based_on_date()
|
public void Download_report_should_trigger_indexer_backoff_on_http429_based_on_date()
|
||||||
{
|
{
|
||||||
var request = new HttpRequest("http://my.indexer.com");
|
var request = new HttpRequest("http://my.indexer.com");
|
||||||
var response = new HttpResponse(request, new HttpHeader(), new byte[0], (HttpStatusCode)429);
|
var response = new HttpResponse(request, new HttpHeader(), Array.Empty<byte>(), (HttpStatusCode)429);
|
||||||
response.Headers["Retry-After"] = DateTime.UtcNow.AddSeconds(300).ToString("r");
|
response.Headers["Retry-After"] = DateTime.UtcNow.AddSeconds(300).ToString("r");
|
||||||
|
|
||||||
var mock = WithUsenetClient();
|
var mock = WithUsenetClient();
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test.Framework
|
||||||
Mocker.SetConstant<IHttpProxySettingsProvider>(new HttpProxySettingsProvider(Mocker.Resolve<ConfigService>()));
|
Mocker.SetConstant<IHttpProxySettingsProvider>(new HttpProxySettingsProvider(Mocker.Resolve<ConfigService>()));
|
||||||
Mocker.SetConstant<ICreateManagedWebProxy>(new ManagedWebProxyFactory(Mocker.Resolve<CacheManager>()));
|
Mocker.SetConstant<ICreateManagedWebProxy>(new ManagedWebProxyFactory(Mocker.Resolve<CacheManager>()));
|
||||||
Mocker.SetConstant<IHttpDispatcher>(new ManagedHttpDispatcher(Mocker.Resolve<IHttpProxySettingsProvider>(), Mocker.Resolve<ICreateManagedWebProxy>(), Mocker.Resolve<UserAgentBuilder>(), Mocker.Resolve<IPlatformInfo>(), TestLogger));
|
Mocker.SetConstant<IHttpDispatcher>(new ManagedHttpDispatcher(Mocker.Resolve<IHttpProxySettingsProvider>(), Mocker.Resolve<ICreateManagedWebProxy>(), Mocker.Resolve<UserAgentBuilder>(), Mocker.Resolve<IPlatformInfo>(), TestLogger));
|
||||||
Mocker.SetConstant<IHttpClient>(new HttpClient(new IHttpRequestInterceptor[0], Mocker.Resolve<CacheManager>(), Mocker.Resolve<RateLimitService>(), Mocker.Resolve<IHttpDispatcher>(), TestLogger));
|
Mocker.SetConstant<IHttpClient>(new HttpClient(Array.Empty<IHttpRequestInterceptor>(), Mocker.Resolve<CacheManager>(), Mocker.Resolve<RateLimitService>(), Mocker.Resolve<IHttpDispatcher>(), TestLogger));
|
||||||
Mocker.SetConstant<IRadarrCloudRequestBuilder>(new RadarrCloudRequestBuilder());
|
Mocker.SetConstant<IRadarrCloudRequestBuilder>(new RadarrCloudRequestBuilder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients())
|
||||||
.Returns(new IDownloadClient[0]);
|
.Returns(Array.Empty<IDownloadClient>());
|
||||||
|
|
||||||
Subject.Check().ShouldBeWarning();
|
Subject.Check().ShouldBeWarning();
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||||
private void WasImportedResponse()
|
private void WasImportedResponse()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetVideoFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetVideoFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
||||||
.Returns(new string[0]);
|
.Returns(System.Array.Empty<string>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||||
|
|
||||||
Mocker.GetMock<IDiskScanService>()
|
Mocker.GetMock<IDiskScanService>()
|
||||||
.Setup(c => c.GetVideoFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
.Setup(c => c.GetVideoFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
||||||
.Returns(new string[0]);
|
.Returns(System.Array.Empty<string>());
|
||||||
|
|
||||||
Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory));
|
Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory));
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@ -103,9 +104,9 @@ namespace NzbDrone.Core.Test.NotificationTests.EmailTests
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_be_valid_if_to_bcc_cc_are_all_empty()
|
public void should_not_be_valid_if_to_bcc_cc_are_all_empty()
|
||||||
{
|
{
|
||||||
_emailSettings.To = new string[] { };
|
_emailSettings.To = Array.Empty<string>();
|
||||||
_emailSettings.CC = new string[] { };
|
_emailSettings.CC = Array.Empty<string>();
|
||||||
_emailSettings.Bcc = new string[] { };
|
_emailSettings.Bcc = Array.Empty<string>();
|
||||||
|
|
||||||
_validator.Validate(_emailSettings).IsValid.Should().BeFalse();
|
_validator.Validate(_emailSettings).IsValid.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
@ -49,8 +50,8 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
Password = settings.Password,
|
Password = settings.Password,
|
||||||
From = settings.From,
|
From = settings.From,
|
||||||
To = new string[] { settings.To },
|
To = new string[] { settings.To },
|
||||||
CC = new string[] { },
|
CC = Array.Empty<string>(),
|
||||||
Bcc = new string[] { }
|
Bcc = Array.Empty<string>()
|
||||||
};
|
};
|
||||||
|
|
||||||
corrected.Add(new ProviderDefinition166
|
corrected.Add(new ProviderDefinition166
|
||||||
|
|
|
@ -349,7 +349,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
|
||||||
{
|
{
|
||||||
if (result.Torrents == null)
|
if (result.Torrents == null)
|
||||||
{
|
{
|
||||||
return new DelugeTorrent[0];
|
return Array.Empty<DelugeTorrent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.Torrents.Values.ToArray();
|
return result.Torrents.Values.ToArray();
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
|
||||||
{
|
{
|
||||||
if (torrentsRaw == null)
|
if (torrentsRaw == null)
|
||||||
{
|
{
|
||||||
return new HadoukenTorrent[0];
|
return Array.Empty<HadoukenTorrent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var torrents = new List<HadoukenTorrent>();
|
var torrents = new List<HadoukenTorrent>();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
|
||||||
|
|
||||||
public TrackedDownload()
|
public TrackedDownload()
|
||||||
{
|
{
|
||||||
StatusMessages = new TrackedDownloadStatusMessage[] { };
|
StatusMessages = System.Array.Empty<TrackedDownloadStatusMessage>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Warn(string message, params object[] args)
|
public void Warn(string message, params object[] args)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using NzbDrone.Core.Annotations;
|
using NzbDrone.Core.Annotations;
|
||||||
|
@ -23,8 +24,8 @@ namespace NzbDrone.Core.ImportLists.Radarr
|
||||||
{
|
{
|
||||||
BaseUrl = "";
|
BaseUrl = "";
|
||||||
ApiKey = "";
|
ApiKey = "";
|
||||||
ProfileIds = new int[] { };
|
ProfileIds = Array.Empty<int>();
|
||||||
TagIds = new int[] { };
|
TagIds = Array.Empty<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Full URL", HelpText = "URL, including port, of the Radarr V3 instance to import from")]
|
[FieldDefinition(0, Label = "Full URL", HelpText = "URL, including port, of the Radarr V3 instance to import from")]
|
||||||
|
|
|
@ -28,8 +28,8 @@ namespace NzbDrone.Core.Indexers.HDBits
|
||||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
||||||
|
|
||||||
Categories = new int[] { (int)HdBitsCategory.Movie };
|
Categories = new int[] { (int)HdBitsCategory.Movie };
|
||||||
Codecs = new int[0];
|
Codecs = System.Array.Empty<int>();
|
||||||
Mediums = new int[0];
|
Mediums = System.Array.Empty<int>();
|
||||||
MultiLanguages = new List<int>();
|
MultiLanguages = new List<int>();
|
||||||
RequiredFlags = new List<int>();
|
RequiredFlags = new List<int>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
@ -35,9 +36,9 @@ namespace NzbDrone.Core.Notifications.Email
|
||||||
Port = 587;
|
Port = 587;
|
||||||
Ssl = true;
|
Ssl = true;
|
||||||
|
|
||||||
To = new string[] { };
|
To = Array.Empty<string>();
|
||||||
CC = new string[] { };
|
CC = Array.Empty<string>();
|
||||||
Bcc = new string[] { };
|
Bcc = Array.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Server", HelpText = "Hostname or IP of Email server")]
|
[FieldDefinition(0, Label = "Server", HelpText = "Hostname or IP of Email server")]
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using NzbDrone.Core.Annotations;
|
using NzbDrone.Core.Annotations;
|
||||||
|
@ -20,8 +21,8 @@ namespace NzbDrone.Core.Notifications.PushBullet
|
||||||
|
|
||||||
public PushBulletSettings()
|
public PushBulletSettings()
|
||||||
{
|
{
|
||||||
DeviceIds = new string[] { };
|
DeviceIds = Array.Empty<string>();
|
||||||
ChannelTags = new string[] { };
|
ChannelTags = Array.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Access Token", HelpLink = "https://www.pushbullet.com/#settings/account")]
|
[FieldDefinition(0, Label = "Access Token", HelpLink = "https://www.pushbullet.com/#settings/account")]
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace NzbDrone.Core.Notifications.Pushover
|
||||||
public PushoverSettings()
|
public PushoverSettings()
|
||||||
{
|
{
|
||||||
Priority = 0;
|
Priority = 0;
|
||||||
Devices = new string[] { };
|
Devices = System.Array.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Get Pushover to change our app name (or create a new app) when we have a new logo
|
//TODO: Get Pushover to change our app name (or create a new app) when we have a new logo
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using NzbDrone.Core.Annotations;
|
using NzbDrone.Core.Annotations;
|
||||||
|
@ -24,7 +25,7 @@ namespace NzbDrone.Core.Notifications.SendGrid
|
||||||
public SendGridSettings()
|
public SendGridSettings()
|
||||||
{
|
{
|
||||||
BaseUrl = "https://api.sendgrid.com/v3/";
|
BaseUrl = "https://api.sendgrid.com/v3/";
|
||||||
Recipients = new string[] { };
|
Recipients = Array.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string BaseUrl { get; set; }
|
public string BaseUrl { get; set; }
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
@ -44,7 +45,7 @@ namespace NzbDrone.Mono.Test.EnvironmentInfo.VersionAdapters
|
||||||
Subject.Read().Should().BeNull();
|
Subject.Read().Should().BeNull();
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Setup(c => c.GetFiles(It.IsAny<string>(), SearchOption.TopDirectoryOnly)).Returns(new string[0]);
|
.Setup(c => c.GetFiles(It.IsAny<string>(), SearchOption.TopDirectoryOnly)).Returns(Array.Empty<string>());
|
||||||
|
|
||||||
Subject.Read().Should().BeNull();
|
Subject.Read().Should().BeNull();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace NzbDrone.Test.Common
|
||||||
{
|
{
|
||||||
_mocker = new AutoMoqer();
|
_mocker = new AutoMoqer();
|
||||||
_mocker.SetConstant<ICacheManager>(new CacheManager());
|
_mocker.SetConstant<ICacheManager>(new CacheManager());
|
||||||
_mocker.SetConstant<IStartupContext>(new StartupContext(new string[0]));
|
_mocker.SetConstant<IStartupContext>(new StartupContext(Array.Empty<string>()));
|
||||||
_mocker.SetConstant(TestLogger);
|
_mocker.SetConstant(TestLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Nancy;
|
using Nancy;
|
||||||
|
@ -57,7 +58,7 @@ namespace Radarr.Api.V3.FileSystem
|
||||||
|
|
||||||
if (!_diskProvider.FolderExists(path))
|
if (!_diskProvider.FolderExists(path))
|
||||||
{
|
{
|
||||||
return new string[0];
|
return Array.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _diskScanService.GetVideoFiles(path).Select(f => new
|
return _diskScanService.GetVideoFiles(path).Select(f => new
|
||||||
|
|
Loading…
Reference in New Issue