Sonarr/NzbDrone.App.Test/MonitoringProviderTest.cs

40 lines
998 B
C#
Raw Normal View History

2011-11-13 18:16:31 +00:00
using System.Diagnostics;
2011-10-07 06:36:04 +00:00
using System.Linq;
2011-10-07 06:36:04 +00:00
using FizzWare.NBuilder;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.Model;
2011-10-07 06:36:04 +00:00
using NzbDrone.Providers;
2011-11-13 18:16:31 +00:00
using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
2011-10-07 06:36:04 +00:00
namespace NzbDrone.App.Test
{
[TestFixture]
2011-11-13 18:16:31 +00:00
public class MonitoringProviderTest : TestBase
2011-10-07 06:36:04 +00:00
{
[Test]
public void Ensure_priority_doesnt_fail_on_invalid_iis_proccess_id()
{
var mocker = new AutoMoqer();
var processMock = mocker.GetMock<ProcessProvider>();
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);
var subject = mocker.Resolve<MonitoringProvider>();
//Act
subject.EnsurePriority(null, null);
}
}
}