public void Should_Service_IsInstalled() { IServiceManager manager = CakeHelper.CreateServiceManager(); bool result1 = manager.IsInstalled("MpsSvc"); bool result2 = manager.IsInstalled("TestSer"); Assert.True(result1); Assert.False(result2); }
public void Should_Service_IsInstalled() { IServiceManager manager = CakeHelper.CreateServiceManager(); bool result1 = manager.IsInstalled("MpsSvc"); result1.ShouldBeTrue(); bool result2 = manager.IsInstalled("TestSer"); result2.ShouldBeFalse(); }
public void Should_Change_Service_State() { IServiceManager manager = CakeHelper.CreateServiceManager(); bool result = false; if (manager.IsRunning("MpsSvc")) { result = manager.Stop("MpsSvc"); } else { result = manager.Start("MpsSvc"); } Assert.True(result, "Check Rights"); }
public void Should_Construct_Install_String() { ServiceManager manager = (ServiceManager)CakeHelper.CreateServiceManager(); var argumentBuilder = manager.CreateInstallArguments("", new InstallSettings() { ServiceName = "TestService", ExecutablePath = @"C:\my\path\to\bin.exe", DisplayName = "Test Service Display Name", Dependencies = "TestDependencies", Username = "******", Password = "******", StartMode = "TestStartMode" }); var actual = argumentBuilder.Render(); System.Diagnostics.Debug.WriteLine(actual); var expected = @"""TestService"" binPath= ""C:/my/path/to/bin.exe"" DisplayName= ""Test Service Display Name"" depend= ""TestDependencies"" start= ""TestStartMode"" obj= ""TestUsername"" password= ""TestPasswordPassword"""; expected.ShouldBe(actual); }
public static IServiceManager CreateServiceManager() { return(new ServiceManager(CakeHelper.CreateEnvironment(), new DebugLog(), CakeHelper.CreatePowershellRunner())); }
public static IPowershellRunner CreatePowershellRunner() { return(new PowershellRunner(CakeHelper.CreateEnvironment(), new DebugLog())); }