Esempio n. 1
0
        public async Task HealthCheckResultProcessor_should_fail_with_bad_probes()
        {
            // arrange
            var watch = new Stopwatch();

            watch.Start();
            var context = new Mock <IAutoHealthCheckContext>();

            context.Setup(c => c.Configurations)
            .Returns(new AutoHealthCheckConfigurations());     // default rule

            var probes = new List <ProbeResult>
            {
                ProbeResult.Error("error"),
                ProbeResult.Ok()
            };

            // act
            var result = await HealthCheckResultProcessor.ProcessResult(
                context.Object,
                watch,
                new HttpResponseMessage[0],
                probes.ToArray());

            // assert
            Assert.NotNull(result);
            Assert.Equal(500, (int)result.HttpStatus);
            Assert.Equal("error", result.UnhealthyProbes.First().ErrorMessage);
            Assert.False(result.Success);
        }
Esempio n. 2
0
        public void ProbeResult_error_should_fail()
        {
            // arrange
            // act
            var result = ProbeResult.Error("error");

            // assert
            Assert.False(result.Succeed);
            Assert.NotNull(result.ErrorMessage);
            Assert.NotEmpty(result.ErrorMessage);
            Assert.Equal("error", result.ErrorMessage);
        }
 public Task <ProbeResult> Check()
 {
     return(Task.FromResult(ProbeResult.Error("custom error")));
 }
Esempio n. 4
0
 public Task <ProbeResult> Check()
 {
     // should be always 0
     return(Task.FromResult(ProbeResult.Error($"custom error {Order}")));
 }