public void Should_Construct_Intsall_String_WithArgs() { 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" } .WithArguments(args => { args.AppendQuoted("CustomName", "Bob"); })); var actual = argumentBuilder.Render(); System.Diagnostics.Debug.WriteLine(actual); var expected = @"""TestService"" binPath= '\""C:/my/path/to/bin.exe\"" -CustomName \""Bob\""' DisplayName= ""Test Service Display Name"" depend= ""TestDependencies"" start= ""TestStartMode"" obj= ""TestUsername"" password= ""TestPasswordPassword"""; expected.ShouldBe(actual); }
public void Should_Get_Service() { IServiceManager manager = CakeHelper.CreateServiceManager(); ServiceController controller = manager.GetService("MpsSvc"); Assert.True(controller != null, "Check Rights"); }
public void Should_Get_Service() { IServiceManager manager = CakeHelper.CreateServiceManager(); ServiceController controller = manager.GetService("MpsSvc"); controller.ShouldNotBeNull("Check Rights"); }
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"""; Assert.Equal(expected, actual); }