1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 12:32:31 +01:00
Radarr/NzbDrone.Update.Test/ProgramFixture.cs

52 lines
1.3 KiB
C#
Raw Normal View History

2011-11-13 21:31:02 +01:00
using System;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.Model;
using NzbDrone.Test.Common;
2013-05-21 06:03:05 +02:00
using NzbDrone.Update.UpdateEngine;
2011-11-13 21:31:02 +01:00
namespace NzbDrone.Update.Test
{
[TestFixture]
public class ProgramFixture : TestBase<UpdateApp>
2011-11-13 21:31:02 +01:00
{
[Test]
public void should_throw_if_null_passed_in()
{
2013-05-21 06:03:05 +02:00
Assert.Throws<ArgumentOutOfRangeException>(() => Subject.Start(null));
2011-11-13 21:31:02 +01:00
}
[TestCase("d", "")]
[TestCase("", "")]
[TestCase("0", "")]
[TestCase("-1", "")]
[TestCase(" ", "")]
[TestCase(".", "")]
public void should_throw_if_first_arg_isnt_an_int(string arg1, string arg2)
{
2013-05-21 06:03:05 +02:00
Assert.Throws<ArgumentOutOfRangeException>(() => Subject.Start(new[] { arg1, arg2 }));
2011-11-13 21:31:02 +01:00
}
[Test]
public void should_call_update_with_corret_path()
{
const string ProcessPath = @"C:\NzbDrone\nzbdrone.exe";
2013-05-11 01:53:50 +02:00
Mocker.GetMock<IProcessProvider>().Setup(c => c.GetProcessById(12))
2011-11-13 21:31:02 +01:00
.Returns(new ProcessInfo() { StartPath = ProcessPath });
2013-05-21 06:03:05 +02:00
Subject.Start(new[] { "12", "" });
Mocker.GetMock<IInstallUpdateService>().Verify(c => c.Start(@"C:\NzbDrone"), Times.Once());
2011-11-13 21:31:02 +01:00
}
}
}