コード例 #1
0
        public async Task AndThereAreALotOfTransfersThenTheyAreProcessedInPages(bool skipPayments)
        {
            // skipPayments will generate error on parallel processing of payments, this should not affect transfers processing

            // arrange
            var expectedTransfers       = ConfigureEventsApi(3, skipPayments).OrderBy(t => t.TransferId).ToList();
            var cancellationTokenSource = new CancellationTokenSource();
            var cancellationToken       = cancellationTokenSource.Token;

            // act
            Task.Run(() => WorkerRole.Run(), cancellationToken);
            var periodEndFinished = TestHelper.ConditionMet(PeriodEndProcessed, TimeSpan.FromSeconds(60));

            cancellationTokenSource.Cancel();

            // assert
            Assert.IsTrue(periodEndFinished);

            var actualCount = await EventTestsRepository.GetNumberOfTransfers();

            Assert.AreEqual(expectedTransfers.Count, actualCount);
        }