1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00
Radarr/NzbDrone.App.Test/MonitoringProviderTest.cs

36 lines
1.0 KiB
C#
Raw Normal View History

using System;
2011-10-07 08:36:04 +02:00
using FizzWare.NBuilder;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.Model;
using NzbDrone.Host;
2011-11-13 19:16:31 +01:00
using NzbDrone.Test.Common;
2011-10-07 08:36:04 +02:00
namespace NzbDrone.App.Test
{
[TestFixture]
2013-04-16 06:52:41 +02:00
public class MonitoringProviderTest : TestBase<PriorityMonitor>
2011-10-07 08:36:04 +02:00
{
[Test]
public void Ensure_priority_doesnt_fail_on_invalid_process_id()
2011-10-07 08:36:04 +02:00
{
2013-05-11 01:53:50 +02:00
Mocker.GetMock<IProcessProvider>().Setup(c => c.GetCurrentProcess())
.Returns(Builder<ProcessInfo>.CreateNew().Build());
2011-10-07 08:36:04 +02:00
2013-05-11 01:53:50 +02:00
Mocker.GetMock<IProcessProvider>().Setup(c => c.GetProcessById(It.IsAny<int>())).Returns((ProcessInfo)null);
2011-10-07 08:36:04 +02:00
2013-04-16 06:52:41 +02:00
Subject.EnsurePriority(null);
}
2011-10-07 08:36:04 +02:00
[Test]
public void Ensure_should_log_warn_exception_rather_than_throw()
{
2013-05-11 01:53:50 +02:00
Mocker.GetMock<IProcessProvider>().Setup(c => c.GetCurrentProcess()).Throws<InvalidOperationException>();
2013-04-16 06:52:41 +02:00
Subject.EnsurePriority(null);
2011-10-07 08:36:04 +02:00
ExceptionVerification.ExpectedWarns(1);
2011-10-07 08:36:04 +02:00
}
}
}