Radarr/src/NzbDrone.Update.Test/StartNzbDroneService.cs

41 lines
1.3 KiB
C#
Raw Normal View History

using System;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Processes;
using NzbDrone.Test.Common;
using NzbDrone.Update.UpdateEngine;
2013-07-24 05:35:32 +00:00
using IServiceProvider = NzbDrone.Common.IServiceProvider;
namespace NzbDrone.Update.Test
{
[TestFixture]
public class StartNzbDroneServiceFixture : TestBase<StartNzbDrone>
{
[Test]
public void should_start_service_if_app_type_was_serivce()
{
Fixed all tests and even added some new ones :) (#835) * First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
2017-03-06 21:23:25 +00:00
const string targetFolder = "c:\\Radarr\\";
Subject.Start(AppType.Service, targetFolder);
2013-07-24 05:35:32 +00:00
Mocker.GetMock<IServiceProvider>().Verify(c => c.Start(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Once());
}
[Test]
public void should_start_console_if_app_type_was_service_but_start_failed_because_of_permissions()
{
Fixed all tests and even added some new ones :) (#835) * First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
2017-03-06 21:23:25 +00:00
const string targetFolder = "c:\\Radarr\\";
2013-07-24 05:35:32 +00:00
Mocker.GetMock<IServiceProvider>().Setup(c => c.Start(ServiceProvider.NZBDRONE_SERVICE_NAME)).Throws(new InvalidOperationException());
Subject.Start(AppType.Service, targetFolder);
Mocker.GetMock<IProcessProvider>().Verify(c => c.SpawnNewProcess("c:\\Radarr\\Radarr.Console.exe", "/" + StartupContext.NO_BROWSER, null), Times.Once());
ExceptionVerification.ExpectedWarns(1);
}
}
}