1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-30 19:56:54 +00:00
Sonarr/NzbDrone.Update.Test/ProgramFixture.cs

52 lines
1.3 KiB
C#
Raw Normal View History

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