public async Task ShouldConvertDocumentIntegrativeWithKnownAberrancyTest(string testFileName, int allowedPixelErrorCount, bool useWebSafeFonts) { var sourceOpenXmlFilePath = $"../../../TestInput/{testFileName}"; var actualHtmlFilePath = Path.Combine(Path.GetTempPath(), $"Actual{testFileName}.html"); var expectedHtmlFilePath = $"../../../ExpectedTestOutcome/{testFileName}.png"; if (File.Exists(actualHtmlFilePath)) { File.Delete(actualHtmlFilePath); } await openXmlToHtml.ConvertToHtmlAsync(sourceOpenXmlFilePath, actualHtmlFilePath, useWebSafeFonts); AssertXhtmlIsValid(actualHtmlFilePath); await DocumentAsserter.AssertRenderedHtmlIsEqual(actualHtmlFilePath, expectedHtmlFilePath, allowedPixelErrorCount); }
public async Task ShouldConvertDocumentAndExportImagesIntegrativeTest(string testFileName) { var sourceOpenXmlFilePath = $"../../../TestInput/{testFileName}"; using var sourceIpenXml = new FileStream(sourceOpenXmlFilePath, FileMode.Open, FileAccess.Read); var exportedImages = new Dictionary <string, byte[]>(); var actuelHtml = await OpenXmlToHtml.ConvertToHtmlAsync(sourceIpenXml, "fallbackTitle", exportedImages, false); Assert.Equal(2, exportedImages.Count); Assert.True(IsValidBitmap(exportedImages.First().Value)); Assert.True(IsValidBitmap(exportedImages.Last().Value)); AssertXhtmlIsValid(actuelHtml); }