public MigrationTaskRunnerTests()
 {
     _db = new Mock <IAccessDb>();
     _db.Setup(d => d.BeginTransaction(null)).Returns(new FakeTransaction());
     LogHelper.Register(new ConsoleLogger(), "Default");
     _sb     = new StringBuilder();
     _runner = new MigrationTaskRunner(_db.Object, LogHelper.DefaultLogger);
 }
        public async Task Run_Tasks(int numItems) {
            var mockTask = new Mock<ITestTask>();
            mockTask
                .Setup(t => t.OperationAsync(It.IsInRange(0, numItems, Range.Inclusive)))
                .Returns(Task.FromResult(0));

            var inputs = Enumerable.Range(0, numItems);

            var runner = new MigrationTaskRunner();

            await runner.RunTasks(async (i) => {
                await mockTask.Object.OperationAsync(i);
            }, inputs, CancellationToken.None);

            mockTask.Verify(t => t.OperationAsync(It.IsInRange(0, numItems, Range.Inclusive)), Times.Exactly(numItems));
        }
        public async Task Run_Tasks(int numItems)
        {
            var mockTask = new Mock <ITestTask>();

            mockTask
            .Setup(t => t.OperationAsync(It.IsInRange(0, numItems, Range.Inclusive)))
            .Returns(Task.FromResult(0));

            var inputs = Enumerable.Range(0, numItems);

            var runner = new MigrationTaskRunner();

            await runner.RunTasks(async (i) => {
                await mockTask.Object.OperationAsync(i);
            }, inputs, CancellationToken.None);

            mockTask.Verify(t => t.OperationAsync(It.IsInRange(0, numItems, Range.Inclusive)), Times.Exactly(numItems));
        }