From 074bf195ebc0c59b1335983904ab0176996ceef5 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 26 Apr 2016 21:59:32 +0100 Subject: Add test for reading files with UTF-8 BOM --- dotnet/Mammoth.Tests/DocumentConverterTests.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'dotnet') diff --git a/dotnet/Mammoth.Tests/DocumentConverterTests.cs b/dotnet/Mammoth.Tests/DocumentConverterTests.cs index 5b53685..adfd368 100644 --- a/dotnet/Mammoth.Tests/DocumentConverterTests.cs +++ b/dotnet/Mammoth.Tests/DocumentConverterTests.cs @@ -6,16 +6,23 @@ namespace Mammoth.Tests { [Fact] public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() { assertSuccessfulConversion( - convertToHtml("single-paragraph.docx"), + ConvertToHtml("single-paragraph.docx"), "

Walking on imported air

"); } + [Fact] + public void CanReadFilesWithUtf8Bom() { + assertSuccessfulConversion( + ConvertToHtml("utf8-bom.docx"), + "

This XML has a byte order mark.

"); + } + private void assertSuccessfulConversion(IResult result, string expectedValue) { Assert.Empty(result.Warnings); Assert.Equal(expectedValue, result.Value); } - private IResult convertToHtml(string name) { + private IResult ConvertToHtml(string name) { return new DocumentConverter().ConvertToHtml(TestFilePath(name)); } -- cgit v1.2.3