mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-16 21:16:24 -04:00
Added some resilience in the GetCurrentProcess calls so it doesn't cause a Fatal exit.
This commit is contained in:
committed by
Mark McDowall
parent
10de8087f7
commit
a62cd042de
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Model;
|
||||
using NzbDrone.Common.Processes;
|
||||
using NzbDrone.Host;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.App.Test
|
||||
{
|
||||
[TestFixture]
|
||||
public class MonitoringProviderTest : TestBase<PriorityMonitor>
|
||||
{
|
||||
[Test]
|
||||
public void Ensure_priority_doesnt_fail_on_invalid_process_id()
|
||||
{
|
||||
Mocker.GetMock<IProcessProvider>().Setup(c => c.GetCurrentProcess())
|
||||
.Returns(Builder<ProcessInfo>.CreateNew().Build());
|
||||
|
||||
Mocker.GetMock<IProcessProvider>().Setup(c => c.GetProcessById(It.IsAny<int>())).Returns((ProcessInfo)null);
|
||||
|
||||
Subject.EnsurePriority(null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ensure_should_log_warn_exception_rather_than_throw()
|
||||
{
|
||||
Mocker.GetMock<IProcessProvider>().Setup(c => c.GetCurrentProcess()).Throws<InvalidOperationException>();
|
||||
Subject.EnsurePriority(null);
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ContainerFixture.cs" />
|
||||
<Compile Include="MonitoringProviderTest.cs" />
|
||||
<Compile Include="NzbDroneProcessServiceFixture.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RouterTest.cs" />
|
||||
|
||||
Reference in New Issue
Block a user