public async Task QueryCount_QueryByMultiAttributes_YieldMatchingResults()
        {
            var exampleQueueId = QueueId.Parse("ExampleQueue");
            var exampleQuery   = new JobQuery
            {
                QueueId       = exampleQueueId,
                HasAttributes = new JobAttributes
                {
                    { "DataCenter", "CAL01" },
                    { "Geo", "USA" }
                }
            };

            var matchingJob1  = JobId.Generate();
            var unmatchedJob1 = JobId.Generate();
            var unmatchedJob2 = JobId.Generate();

            var existingJobs = new[] { new Job
                                       {
                                           Id         = unmatchedJob1,
                                           QueueId    = exampleQueueId,
                                           Attributes = new JobAttributes
                                           {
                                               { "DataCenter", "CAL01" },
                                           }
                                       }, new Job
                                       {
                                           Id         = matchingJob1,
                                           QueueId    = exampleQueueId,
                                           Attributes = new JobAttributes
                                           {
                                               { "DataCenter", "CAL01" },
                                               { "Geo", "USA" }
                                           }
                                       }, new Job
                                       {
                                           Id         = unmatchedJob2,
                                           QueueId    = exampleQueueId,
                                           Attributes = new JobAttributes
                                           {
                                               { "Geo", "USA" },
                                           }
                                       } };

            await RunInMongoLand(async database =>
            {
                var jobs = database.GetJobCollection();

                await jobs.InsertManyAsync(existingJobs).ConfigureAwait(false);

                var sut = new MongoJobQueryCountService(database);

                var results = (await sut.QueryCount(exampleQuery).ConfigureAwait(false));

                long expected = 1;

                Assert.That(results, Is.Not.Null);
                Assert.AreEqual(results, expected);
            }).ConfigureAwait(false);
        }
        public async Task QueryCount_Skip_YieldSkipped()
        {
            var exampleQueueId = QueueId.Parse("ExampleQueue");
            var exampleQuery   = new JobQuery
            {
                QueueId = exampleQueueId,
                Skip    = 2,
            };

            var existingJobs = new[] { new Job
                                       {
                                           Id      = JobId.Generate(),
                                           QueueId = exampleQueueId
                                       }, new Job
                                       {
                                           Id      = JobId.Generate(),
                                           QueueId = exampleQueueId
                                       }, new Job
                                       {
                                           Id      = JobId.Generate(),
                                           QueueId = exampleQueueId
                                       } };

            await RunInMongoLand(async database =>
            {
                var jobs = database.GetJobCollection();

                await jobs.InsertManyAsync(existingJobs).ConfigureAwait(false);

                var sut = new MongoJobQueryCountService(database);

                var results = (await sut.QueryCount(exampleQuery).ConfigureAwait(false));

                long expected = 3;

                Assert.That(results, Is.Not.Null);
                Assert.AreEqual(results, expected);
            }).ConfigureAwait(false);
        }