From 83ab30b58328602eb233522b8dea8d2f13f11f13 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 26 Apr 2016 21:58:27 +0100 Subject: Add basic test --- dotnet/Mammoth.Tests/DocumentConverterTests.cs | 24 +++++++++++++++++++++++- dotnet/Mammoth.Tests/Mammoth.Tests.csproj | 23 +++++++++++++++++++++++ dotnet/Mammoth.Tests/TestData | 1 + dotnet/makefile | 7 +++++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 120000 dotnet/Mammoth.Tests/TestData create mode 100644 dotnet/makefile diff --git a/dotnet/Mammoth.Tests/DocumentConverterTests.cs b/dotnet/Mammoth.Tests/DocumentConverterTests.cs index 112087a..5b53685 100644 --- a/dotnet/Mammoth.Tests/DocumentConverterTests.cs +++ b/dotnet/Mammoth.Tests/DocumentConverterTests.cs @@ -1,5 +1,27 @@ -namespace Mammoth.Tests { +using Xunit; +using System.IO; + +namespace Mammoth.Tests { public class DocumentConverterTests { + [Fact] + public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() { + assertSuccessfulConversion( + convertToHtml("single-paragraph.docx"), + "

Walking on imported air

"); + } + + private void assertSuccessfulConversion(IResult result, string expectedValue) { + Assert.Empty(result.Warnings); + Assert.Equal(expectedValue, result.Value); + } + + private IResult convertToHtml(string name) { + return new DocumentConverter().ConvertToHtml(TestFilePath(name)); + } + + private string TestFilePath(string name) { + return Path.Combine("../../TestData", name); + } } } diff --git a/dotnet/Mammoth.Tests/Mammoth.Tests.csproj b/dotnet/Mammoth.Tests/Mammoth.Tests.csproj index 89daf3b..d561dde 100644 --- a/dotnet/Mammoth.Tests/Mammoth.Tests.csproj +++ b/dotnet/Mammoth.Tests/Mammoth.Tests.csproj @@ -51,4 +51,27 @@ + + + + + + + + + + + + + + + + + + + + {51C5CBD6-8809-4D5E-BABE-1787A16F5ED8} + Mammoth + + \ No newline at end of file diff --git a/dotnet/Mammoth.Tests/TestData b/dotnet/Mammoth.Tests/TestData new file mode 120000 index 0000000..f8f6221 --- /dev/null +++ b/dotnet/Mammoth.Tests/TestData @@ -0,0 +1 @@ +../../src/test/resources/test-data \ No newline at end of file diff --git a/dotnet/makefile b/dotnet/makefile new file mode 100644 index 0000000..aeeb74b --- /dev/null +++ b/dotnet/makefile @@ -0,0 +1,7 @@ +.PHONY: build test + +build: + xbuild Mammoth.sln + +test: build + mono --debug packages/xunit.runner.console.2.1.0/tools/xunit.console.exe Mammoth.Tests/bin/Debug/Mammoth.Tests.dll -noshadow -- cgit v1.2.3