Ejemplo n.º 1
0
        public async Task EstimateTotal_ShouldReturnOne_IfNoLeaseDocumentsCreated()
        {
            IReadOnlyList <ILease> leases = new List <ILease>(0);
            var sut = new RemainingWorkEstimator(
                Mock.Of <ILeaseContainer>(m => m.GetAllLeasesAsync() == Task.FromResult(leases)),
                Mock.Of <IChangeFeedDocumentClient>(),
                collectionSelfLink,
                1);
            long pendingWork = await sut.GetEstimatedRemainingWork();

            Assert.Equal(1, pendingWork);
        }
Ejemplo n.º 2
0
        public async Task EstimateTotal_ShouldReturnPendingWork_IfOnePartition()
        {
            IReadOnlyList <ILease> leases = new List <ILease> {
                Mock.Of <ILease>(l => l.PartitionId == "1" && l.ContinuationToken == "100")
            };
            var sut = new RemainingWorkEstimator(
                Mock.Of <ILeaseContainer>(m => m.GetAllLeasesAsync() == Task.FromResult(leases)),
                Mock.Of <IChangeFeedDocumentClient>()
                .SetupQueryResponse("1", "100", "101", "1:106"),
                collectionSelfLink,
                1);
            long pendingWork = await sut.GetEstimatedRemainingWork();

            Assert.Equal(6, pendingWork);
        }
        public async Task Estimate_ShouldReturnPendingWork()
        {
            long pendingWork = await remainingWorkEstimator.GetEstimatedRemainingWork();

            Assert.Equal(6, pendingWork);
        }