Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void Should_Service_IsInstalled()
        {
            IServiceManager manager = CakeHelper.CreateServiceManager();

            bool result1 = manager.IsInstalled("MpsSvc");

            result1.ShouldBeTrue();

            bool result2 = manager.IsInstalled("TestSer");

            result2.ShouldBeFalse();
        }
Ejemplo n.º 3
0
        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");
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public static IServiceManager CreateServiceManager()
 {
     return(new ServiceManager(CakeHelper.CreateEnvironment(), new DebugLog(), CakeHelper.CreatePowershellRunner()));
 }
Ejemplo n.º 6
0
 public static IPowershellRunner CreatePowershellRunner()
 {
     return(new PowershellRunner(CakeHelper.CreateEnvironment(), new DebugLog()));
 }