From ff98a9a2804d5e7c042d6bb400cd9265cf00fa85 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 30 Apr 2016 16:47:03 +0100 Subject: Convert tabs to spaces --- dotnet/Mammoth.Tests/DocumentConverterTests.cs | 168 ++++++++++++------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/dotnet/Mammoth.Tests/DocumentConverterTests.cs b/dotnet/Mammoth.Tests/DocumentConverterTests.cs index 8526b04..89ade1c 100644 --- a/dotnet/Mammoth.Tests/DocumentConverterTests.cs +++ b/dotnet/Mammoth.Tests/DocumentConverterTests.cs @@ -5,33 +5,33 @@ using System; using System.Linq; namespace Mammoth.Tests { - public class DocumentConverterTests { - [Fact] - public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() { - AssertSuccessfulConversion( - ConvertToHtml("single-paragraph.docx"), - "

Walking on imported air

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

This XML has a byte order mark.

"); - } - - [Fact] - public void EmptyParagraphsAreIgnoredByDefault() { - AssertSuccessfulConversion( - ConvertToHtml("empty.docx"), - ""); - } - - [Fact] - public void EmptyParagraphsArePreservedIfIgnoreEmptyParagraphsIsFalse() { - AssertSuccessfulConversion( - ConvertToHtml("empty.docx", converter => converter.PreserveEmptyParagraphs()), - "

"); + public class DocumentConverterTests { + [Fact] + public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() { + AssertSuccessfulConversion( + ConvertToHtml("single-paragraph.docx"), + "

Walking on imported air

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

This XML has a byte order mark.

"); + } + + [Fact] + public void EmptyParagraphsAreIgnoredByDefault() { + AssertSuccessfulConversion( + ConvertToHtml("empty.docx"), + ""); + } + + [Fact] + public void EmptyParagraphsArePreservedIfIgnoreEmptyParagraphsIsFalse() { + AssertSuccessfulConversion( + ConvertToHtml("empty.docx", converter => converter.PreserveEmptyParagraphs()), + "

"); } [Fact] @@ -41,30 +41,30 @@ namespace Mammoth.Tests { ""); } - [Fact] - public void WordTablesAreConvertedToHtmlTables() { - AssertSuccessfulConversion( - ConvertToHtml("tables.docx"), - "

Above

" + - "" + - "" + - "" + - "

Top left

Top right

Bottom left

Bottom right

" + - "

Below

"); - } + [Fact] + public void WordTablesAreConvertedToHtmlTables() { + AssertSuccessfulConversion( + ConvertToHtml("tables.docx"), + "

Above

" + + "" + + "" + + "" + + "

Top left

Top right

Bottom left

Bottom right

" + + "

Below

"); + } - [Fact] - public void InlineImagesAreIncludedInOutput() { - AssertSuccessfulConversion( - ConvertToHtml("tiny-picture.docx"), - "

"); - } + [Fact] + public void InlineImagesAreIncludedInOutput() { + AssertSuccessfulConversion( + ConvertToHtml("tiny-picture.docx"), + "

"); + } - [Fact] - public void ImagesStoredOutsideOfDocumentAreIncludedInOutput() { - AssertSuccessfulConversion( - ConvertToHtml("external-picture.docx"), - "

"); + [Fact] + public void ImagesStoredOutsideOfDocumentAreIncludedInOutput() { + AssertSuccessfulConversion( + ConvertToHtml("external-picture.docx"), + "

"); } [Fact] @@ -164,40 +164,40 @@ namespace Mammoth.Tests { Assert.Equal("

Apple

Banana

", result.Value); } - [Fact] - public void CanExtractRawTextFromFile() { - AssertSuccessfulConversion( - new DocumentConverter().ExtractRawText(TestFilePath("simple-list.docx")), - "Apple\n\nBanana\n\n"); - } - - [Fact] - public void CanExtractRawTextFromStream() { - using (var file = File.OpenRead(TestFilePath("simple-list.docx"))) { - AssertSuccessfulConversion( - new DocumentConverter().ExtractRawText(file), - "Apple\n\nBanana\n\n"); - } - } - - private void AssertSuccessfulConversion(IResult result, string expectedValue) { - if (result.Warnings.Count > 0) { - throw new XunitException("Unexpected warnings: " + string.Join(", ", result.Warnings)); - } - Assert.Equal(expectedValue, result.Value); - } - - private IResult ConvertToHtml(string name) { - return ConvertToHtml(name, converter => converter); - } - - private IResult ConvertToHtml(string name, Func configure) { - return configure(new DocumentConverter()).ConvertToHtml(TestFilePath(name)); - } - - private string TestFilePath(string name) { - return Path.Combine("../../TestData", name); - } - } + [Fact] + public void CanExtractRawTextFromFile() { + AssertSuccessfulConversion( + new DocumentConverter().ExtractRawText(TestFilePath("simple-list.docx")), + "Apple\n\nBanana\n\n"); + } + + [Fact] + public void CanExtractRawTextFromStream() { + using (var file = File.OpenRead(TestFilePath("simple-list.docx"))) { + AssertSuccessfulConversion( + new DocumentConverter().ExtractRawText(file), + "Apple\n\nBanana\n\n"); + } + } + + private void AssertSuccessfulConversion(IResult result, string expectedValue) { + if (result.Warnings.Count > 0) { + throw new XunitException("Unexpected warnings: " + string.Join(", ", result.Warnings)); + } + Assert.Equal(expectedValue, result.Value); + } + + private IResult ConvertToHtml(string name) { + return ConvertToHtml(name, converter => converter); + } + + private IResult ConvertToHtml(string name, Func configure) { + return configure(new DocumentConverter()).ConvertToHtml(TestFilePath(name)); + } + + private string TestFilePath(string name) { + return Path.Combine("../../TestData", name); + } + } } -- cgit v1.2.3