public async Task CreatedActivitiesShouldAppearInBothElasticAndCosmos(int activitiesToCreate)
        {
            var fixtures = new IntegrityCheckTestFixtures();

            await fixtures.CreateActivities(activitiesToCreate);

            var tasks = new []
            {
                fixtures.AssertAllCreatedActivitiesAppearInCosmos(),
                fixtures.AssertAllCreatedActivitiesAppearInElastic()
            };

            await Task.WhenAll(tasks);
        }
        public async Task ActivitiesMissingInBothSidesShouldEchoBothWays(int totalActivitiesRequired, int activitiesToRemoveFromCosmos, int activitiesToRemoveFromElastic)
        {
            // arrange
            var fixtures = new IntegrityCheckTestFixtures();

            await fixtures.DeleteAllExistingActivitiesFromElasticAndCosmos();

            await fixtures.CreateActivities(totalActivitiesRequired);

            var randomActivities =
                fixtures.GetRandomPostedActivities(activitiesToRemoveFromCosmos + activitiesToRemoveFromElastic);
            var cosmosDeleted  = randomActivities.Take(activitiesToRemoveFromCosmos).ToArray();
            var elasticDeleted = randomActivities.Skip(activitiesToRemoveFromCosmos).Take(activitiesToRemoveFromElastic).ToArray();

            var deleteTasks = new Task[]
            {
                fixtures.DeleteActivitiesFromCosmos(cosmosDeleted),
                fixtures.DeleteActivitiesFromElastic(elasticDeleted)
            };

            Task.WaitAll(deleteTasks);

            // Action
            var logger = await fixtures.RunIntegrityCheck($"_{totalActivitiesRequired}.{activitiesToRemoveFromCosmos}");

            fixtures.CancellationTokenSource.Cancel();

            // Assert
            await fixtures.AssertAllCreatedActivitiesAppearInCosmos();

            await fixtures.AssertAllCreatedActivitiesAppearInElastic();

            int expectedNumberOfFixes = activitiesToRemoveFromCosmos + activitiesToRemoveFromElastic;
            int actualNumberOfFixes   = logger.FixesApplied;

            Assert.AreEqual(expectedNumberOfFixes, actualNumberOfFixes, "Incorrect number of fixes applied");
        }
        public async Task ActivitiesMissingInCosmosShouldBeRecreatedFromElastic(int totalActivitiesRequired, int activitiesToRemoveFromCosmos)
        {
            // arrange
            var fixtures = new IntegrityCheckTestFixtures();

            await fixtures.DeleteAllExistingActivitiesFromElasticAndCosmos();

            await fixtures.CreateActivities(totalActivitiesRequired);

            await fixtures.DeleteActivitiesFromCosmos(activitiesToRemoveFromCosmos);

            // Act
            var logger = await fixtures.RunIntegrityCheck($"_{totalActivitiesRequired}.{activitiesToRemoveFromCosmos}");

            fixtures.CancellationTokenSource.Cancel();

            // Assert
            await fixtures.AssertAllCreatedActivitiesAppearInCosmos();

            int expectedNumberOfFixes = activitiesToRemoveFromCosmos;
            int actualNumberOfFixes   = logger.FixesApplied;

            Assert.AreEqual(expectedNumberOfFixes, actualNumberOfFixes, "Incorrect number of fixes applied");
        }