mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -07:00
fixed apptype detection during update
This commit is contained in:
parent
2573558321
commit
99f269cd95
11 changed files with 300 additions and 187 deletions
|
@ -5,38 +5,21 @@ using NUnit.Framework;
|
|||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Model;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Update.Providers;
|
||||
using NzbDrone.Update.UpdateEngine;
|
||||
|
||||
namespace NzbDrone.Update.Test
|
||||
{
|
||||
[TestFixture]
|
||||
public class ProgramFixture : TestBase
|
||||
public class ProgramFixture : TestBase<Program>
|
||||
{
|
||||
private Program _program;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_program = Mocker.Resolve<Program>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_throw_if_null_passed_in()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => _program.Start(null));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => Subject.Start(null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_throw_if_less_than_two_arguments_arent_passed_in()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => _program.Start(new[] { "" }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_throw_if_more_than_two_arguments_arent_passed_in()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => _program.Start(new[] { "", "", "" }));
|
||||
}
|
||||
|
||||
[TestCase("d", "")]
|
||||
[TestCase("", "")]
|
||||
|
@ -46,7 +29,7 @@ namespace NzbDrone.Update.Test
|
|||
[TestCase(".", "")]
|
||||
public void should_throw_if_first_arg_isnt_an_int(string arg1, string arg2)
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => _program.Start(new[] { arg1, arg2 }));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => Subject.Start(new[] { arg1, arg2 }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -57,11 +40,11 @@ namespace NzbDrone.Update.Test
|
|||
Mocker.GetMock<IProcessProvider>().Setup(c => c.GetProcessById(12))
|
||||
.Returns(new ProcessInfo() { StartPath = ProcessPath });
|
||||
|
||||
|
||||
_program.Start(new[] { "12", "" });
|
||||
|
||||
|
||||
Mocker.GetMock<UpdateProvider>().Verify(c => c.Start(@"C:\NzbDrone"), Times.Once());
|
||||
Subject.Start(new[] { "12", "" });
|
||||
|
||||
|
||||
Mocker.GetMock<IInstallUpdateService>().Verify(c => c.Start(@"C:\NzbDrone"), Times.Once());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue