コード例 #1
0
        private async Task AssertSinglePageJpegResultsAsync(IEnumerable <ConversionResult> results, Action <string> customAssertions = null)
        {
            for (int i = 0; i < results.Count(); i++)
            {
                ConversionResult result = results.ElementAt(i);

                Assert.IsTrue(result.IsSuccess);
                Assert.AreEqual(1, result.PageCount, "Wrong page count for result");

                ConversionSourceDocument resultSourceDocument = result.Sources.ToList()[0];
                Assert.IsNotNull(resultSourceDocument.RemoteWorkFile);
                Assert.IsNull(resultSourceDocument.Password);
                Assert.AreEqual((i + 1).ToString(), resultSourceDocument.Pages, "Wrong source page range for result");

                string filename = $"page-{i}.jpg";
                await result.RemoteWorkFile.SaveAsync(filename);

                FileAssert.IsJpeg(filename);

                customAssertions?.Invoke(filename);
            }
        }