Пример #1
0
        public void MultipleInvalidServices()
        {
            const string serviceName1 = "ASDEDFG123234fwerw4f";
            const string serviceName2 = "ERseSfsdfDF23£23eE";

            using (var domain = new WindowServiceStartupDomain(new WindowsServiceStartupCheckConfig
            {
                Enabled = true,
                ExpectedStartupType = "Auto",
                FriendlyId = "HealthCheckTest",
                Services = new List <string>
                {
                    serviceName1,
                    serviceName2
                }
            }))
            {
                Feature.WithScenario("Multiple invalid windows service names supplied")
                .Given(domain.TheAgentIsStarted)
                .When(domain.TheHealthCheckIsInvoked)
                .Then(domain.ShouldThrow_Exception, typeof(InvalidOperationException))
                .And(domain._ShouldBeInTheExceptionMesssage, serviceName1)
                .And(domain._ShouldBeInTheExceptionMesssage, serviceName2)
                .ExecuteWithReport();
            }
        }
        public void MultipleInvalidServices()
        {
            const string serviceName1 = "ASDEDFG123234fwerw4f";
            const string serviceName2 = "ERseSfsdfDF23£23eE";

            using (var domain = new WindowServiceStartupDomain(new WindowsServiceStartupCheckConfig
                                                  {
                                                      Enabled = true,
                                                      ExpectedStartupType = "Auto",
                                                      FriendlyId = "HealthCheckTest",
                                                      Services = new List<string>
                                                                     {
                                                                         serviceName1,
                                                                         serviceName2
                                                                     }
                                                  }))
            {

                Feature.WithScenario("Multiple invalid windows service names supplied")
                    .Given(domain.TheAgentIsStarted)
                    .When(domain.TheHealthCheckIsInvoked)
                    .Then(domain.ShouldThrow_Exception, typeof(InvalidOperationException))
                        .And(domain._ShouldBeInTheExceptionMesssage, serviceName1)
                        .And(domain._ShouldBeInTheExceptionMesssage, serviceName2)
                    .ExecuteWithReport();
            }
        }
Пример #3
0
 public void ValidServiceIncorrectStartup()
 {
     using (var domain = new WindowServiceStartupDomain(new WindowsServiceStartupCheckConfig
     {
         Enabled = true,
         ExpectedStartupType = "Disabled",
         FriendlyId = "HealthCheckTest",
         Services = new List <string>
         {
             "DHCP Client"
         }
     }))
     {
         Feature.WithScenario("A valid windows service name specified but the startup type is incorrect")
         .Given(domain.TheAgentIsStarted)
         .When(domain.TheHealthCheckIsInvoked)
         .Then(domain.ThereShouldBe_HealthCheckNotificationsReceived, 1)
         //.And(domain.TheResultMessageShouldIndicateFailure)
         .ExecuteWithReport();
     }
 }
Пример #4
0
 public void ValidServiceCorrectStartup()
 {
     using (var domain = new WindowServiceStartupDomain(new WindowsServiceStartupCheckConfig
     {
         Enabled = true,
         ExpectedStartupType = "Auto",
         FriendlyId = "HealthCheckTest",
         Services = new List <string>
         {
             "DHCP Client"
         }
     }))
     {
         Feature.WithScenario("A valid windows service name specified and it should have the expected startup type")
         .Given(domain.TheAgentIsStarted)
         .When(domain.TheHealthCheckIsInvoked)
         .Then(domain.ThrewNoException)
         .And(domain.ThereShouldBe_HealthCheckNotificationsReceived, 0)
         .ExecuteWithReport();
     }
 }
 public void ValidServiceCorrectStartup()
 {
     using (var domain = new WindowServiceStartupDomain(new WindowsServiceStartupCheckConfig
                                           {
                                               Enabled = true,
                                               ExpectedStartupType = "Auto",
                                               FriendlyId = "HealthCheckTest",
                                               Services = new List<string>
                                                              {
                                                                  "DHCP Client"
                                                              }
                                           }))
     {
         Feature.WithScenario("A valid windows service name specified and it should have the expected startup type")
             .Given(domain.TheAgentIsStarted)
             .When(domain.TheHealthCheckIsInvoked)
             .Then(domain.ThrewNoException)
                 .And(domain.ThereShouldBe_HealthCheckNotificationsReceived, 0)
             .ExecuteWithReport();
     }
 }
 public void ValidServiceIncorrectStartup()
 {
     using (var domain = new WindowServiceStartupDomain(new WindowsServiceStartupCheckConfig
                                           {
                                               Enabled = true,
                                               ExpectedStartupType = "Disabled",
                                               FriendlyId = "HealthCheckTest",
                                               Services = new List<string>
                                                              {
                                                                  "DHCP Client"
                                                              }
                                           }))
     {
         Feature.WithScenario("A valid windows service name specified but the startup type is incorrect")
             .Given(domain.TheAgentIsStarted)
             .When(domain.TheHealthCheckIsInvoked)
             .Then(domain.ThereShouldBe_HealthCheckNotificationsReceived, 1)
             //.And(domain.TheResultMessageShouldIndicateFailure)
             .ExecuteWithReport();
     }
 }