Exemplo n.º 1
0
        public async Task IsHealthOkDelegatesToCosmos()
        {
            bool   expectedOk      = NewRandomFlag();
            string expectedMessage = NewRandomString();

            GivenTheCosmosHealth(expectedOk, expectedMessage);

            ServiceHealth serviceHealth = await WhenTheServiceHealthIsQueried();

            serviceHealth.Dependencies.Count
            .Should()
            .Be(1);

            DependencyHealth health = serviceHealth.Dependencies.Single();

            health
            .Should()
            .BeEquivalentTo(new DependencyHealth
            {
                HealthOk = expectedOk,
                Message  = expectedMessage
            },
                            opt
                            => opt.Excluding(_ => _.DependencyName));
        }
Exemplo n.º 2
0
        public async Task IsHealthOkChecksCosmosRepository()
        {
            bool   expectedIsOkFlag = new RandomBoolean();
            string expectedMessage  = new RandomString();

            GivenTheRepositoryServiceHealth(expectedIsOkFlag, expectedMessage);

            ServiceHealth isHealthOk = await _repository.IsHealthOk();

            isHealthOk
            .Should()
            .NotBeNull();

            isHealthOk
            .Name
            .Should()
            .Be(nameof(PublishedFundingRepository));

            DependencyHealth dependencyHealth = isHealthOk
                                                .Dependencies
                                                .FirstOrDefault();

            dependencyHealth
            .Should()
            .Match <DependencyHealth>(_ => _.HealthOk == expectedIsOkFlag &&
                                      _.Message == expectedMessage);
        }