You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/NzbDrone.App.Test/MonitoringProviderTest.cs

36 lines
1.1 KiB

using System;
using System.Diagnostics;
using FizzWare.NBuilder;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.Model;
using NzbDrone.Test.Common;
namespace NzbDrone.App.Test
{
[TestFixture]
12 years ago
public class MonitoringProviderTest : TestBase<PriorityMonitor>
{
[Test]
public void Ensure_priority_doesnt_fail_on_invalid_iis_proccess_id()
{
Mocker.GetMock<ProcessProvider>().Setup(c => c.GetCurrentProcess())
.Returns(Builder<ProcessInfo>.CreateNew().With(c => c.Priority == ProcessPriorityClass.Normal).Build());
Mocker.GetMock<ProcessProvider>().Setup(c => c.GetProcessById(It.IsAny<int>())).Returns((ProcessInfo)null);
12 years ago
Subject.EnsurePriority(null);
}
[Test]
public void Ensure_should_log_warn_exception_rather_than_throw()
{
Mocker.GetMock<ProcessProvider>().Setup(c => c.GetCurrentProcess()).Throws<InvalidOperationException>();
12 years ago
Subject.EnsurePriority(null);
ExceptionVerification.ExpectedWarns(1);
}
}
}