fixed apptype detection during update

This commit is contained in:
kay.one 2013-05-20 21:03:05 -07:00
commit 99f269cd95
11 changed files with 300 additions and 187 deletions

View file

@ -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());
}