コード例 #1
0
        public void ShouldInstallSyncthingService()
        {
            Installer.SetInternalUI(InstallUIOptions.ProgressOnly);
            Installer.InstallProduct(msiFilename, "ACTION=INSTALL ALLUSERS=2 MSIINSTALLPERUSER="******"Service did not start after Installing");
        }
コード例 #2
0
        public void ShouldStartSyncthingService()
        {
            if (!isSyncthingInstalled())
            {
                ShouldInstallSyncthingService();
            }
            var startSyncthingWrapper = new SyncthingServiceWrapper.SyncthingService();
            ServiceController service = new ServiceController(startSyncthingWrapper.ServiceName);

            if (service.Status == ServiceControllerStatus.Stopped)
            {
                service.Start();
            }
            service.WaitForStatus(ServiceControllerStatus.Running, new TimeSpan(0, 0, 10));
            Assert.IsTrue(service.Status == ServiceControllerStatus.Running, "Service did not start as expected");
        }
コード例 #3
0
        public void ShouldUninstallSyncthingService()
        {
            if (!isSyncthingInstalled())
            {
                ShouldInstallSyncthingService();
            }
            Process p = new Process();

            p.StartInfo.FileName  = "msiexec.exe";
            p.StartInfo.Arguments = "/x \"" + msiFilename + "\"/passive";
            p.Start();
            var startSyncthingWrapper = new SyncthingServiceWrapper.SyncthingService();
            ServiceController service = new ServiceController(startSyncthingWrapper.ServiceName);

            service.WaitForStatus(ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 20));
            Assert.IsTrue(service.Status == ServiceControllerStatus.Stopped, "Service did not start after Installing");
        }