示例#1
0
    public void RunAsService()
    {
        SampleInstaller.Delete();
        SampleInstaller.Create();
        using (var controller = GetController())
        {
            Assert.Equal(ServiceControllerStatus.Stopped, controller.Status);

            controller.Start();
            controller.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(15));
            controller.Refresh();
            Assert.Equal(ServiceControllerStatus.Running, controller.Status);

            controller.Stop();
            controller.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(15));
            controller.Refresh();
            Assert.Equal(ServiceControllerStatus.Stopped, controller.Status);

            SampleInstaller.Delete();
        }
    }
示例#2
0
 public void Install()
 {
     SampleInstaller.Delete();
     SampleInstaller.Create();
 }