2011-11-13 21:16:31 +03:00
|
|
|
using System.Diagnostics;
|
2011-10-07 09:36:04 +03:00
|
|
|
using System.Linq;
|
2011-11-14 03:22:18 +03:00
|
|
|
|
2011-10-07 09:36:04 +03:00
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using Moq;
|
|
|
|
using NUnit.Framework;
|
2011-10-23 08:26:43 +03:00
|
|
|
using NzbDrone.Common;
|
|
|
|
using NzbDrone.Common.Model;
|
2011-10-07 09:36:04 +03:00
|
|
|
using NzbDrone.Providers;
|
2011-11-13 21:16:31 +03:00
|
|
|
using NzbDrone.Test.Common;
|
2011-11-14 03:22:18 +03:00
|
|
|
using NzbDrone.Test.Common.AutoMoq;
|
2011-10-07 09:36:04 +03:00
|
|
|
|
|
|
|
namespace NzbDrone.App.Test
|
|
|
|
{
|
|
|
|
[TestFixture]
|
2011-11-13 21:16:31 +03:00
|
|
|
public class MonitoringProviderTest : TestBase
|
2011-10-07 09:36:04 +03:00
|
|
|
{
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Ensure_priority_doesnt_fail_on_invalid_iis_proccess_id()
|
|
|
|
{
|
2011-12-15 07:15:53 +03:00
|
|
|
var processMock = Mocker.GetMock<ProcessProvider>();
|
2011-10-07 09:36:04 +03:00
|
|
|
processMock.Setup(c => c.GetCurrentProcess())
|
|
|
|
.Returns(Builder<ProcessInfo>.CreateNew().With(c => c.Priority == ProcessPriorityClass.Normal).Build());
|
|
|
|
|
|
|
|
processMock.Setup(c => c.GetProcessById(It.IsAny<int>())).Returns((ProcessInfo)null);
|
|
|
|
|
2011-12-15 07:15:53 +03:00
|
|
|
var subject = Mocker.Resolve<MonitoringProvider>();
|
2011-10-07 09:36:04 +03:00
|
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-02-11 04:43:07 +03:00
|
|
|
subject.EnsurePriority(null);
|
2011-10-07 09:36:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|