Ejemplo n.º 1
0
        public async Task ProcessingSingle_CheckResult(string data, int expected)
        {
            var path        = CreateFileForTest(sourceFolderPath, data);
            var fileHandler = new DocumentsPipeline(processingFolderPath, resultFolderPath, 1, CancellationToken.None);

            await fileHandler.Processing(path);

            await fileHandler.Complete();

            var result = ExtractResult(resultFolderPath, Path.GetFileName(path));

            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 2
0
        public async Task ProcessingArray_CheckResult(int count, int expected, int maxDegreeOfParallelism)
        {
            var paths       = Enumerable.Range(1, count).Select(s => CreateFileForTest(sourceFolderPath, Resources.Example)).ToArray();
            var fileHandler = new DocumentsPipeline(processingFolderPath, resultFolderPath, maxDegreeOfParallelism, CancellationToken.None);

            foreach (var path in paths)
            {
                await fileHandler.Processing(path);
            }

            await fileHandler.Complete();

            var result = paths.Select(s => ExtractResult(resultFolderPath, Path.GetFileName(s))).Sum();

            Assert.AreEqual(expected, result);
        }