Example #1
0
        public void Should_result_in_a_custom_check_failed_event()
        {
            var context = new When_a_periodic_custom_check_fails.MyContext();

            EventLogItem entry = null;

            Scenario.Define(context)
            .WithEndpoint <ManagementEndpoint>(c => c.AppConfig(PathToAppConfig))
            .WithEndpoint <EndpointWithFailingCustomCheck>()
            .Done(c => TryGetSingle("/api/eventlogitems/", out entry, e => e.EventType == typeof(CustomCheckFailed).Name))
            .Run();

            Assert.AreEqual(Severity.Error, entry.Severity, "Failed custom checks should be treated as info");
            Assert.IsTrue(entry.RelatedTo.Any(item => item == "/customcheck/EventuallyFailingCustomCheck"));
            Assert.IsTrue(entry.RelatedTo.Any(item => item.StartsWith("/endpoint/CustomChecks.EndpointWithFailingCustomCheck")));
        }
        public void Should_result_in_a_custom_check_failed_event()
        {
            var context = new When_a_periodic_custom_check_fails.MyContext();

            EventLogItem entry = null;

            Scenario.Define(context)
                .WithEndpoint<ManagementEndpoint>(c => c.AppConfig(PathToAppConfig))
                .WithEndpoint<EndpointWithFailingCustomCheck>()
                .Done(c => TryGetSingle("/api/eventlogitems/", out entry, e => e.EventType == typeof(CustomCheckFailed).Name))
                .Run();

            Assert.AreEqual(Severity.Error, entry.Severity, "Failed custom checks should be treated as info");
            Assert.IsTrue(entry.RelatedTo.Any(item => item == "/customcheck/EventuallyFailingCustomCheck"));
            Assert.IsTrue(entry.RelatedTo.Any(item => item.StartsWith("/endpoint/CustomChecks.EndpointWithFailingCustomCheck")));

        }