aboutsummaryrefslogtreecommitdiff
path: root/dotnet/Mammoth.Tests/DocumentConverterTests.cs
blob: 5b53685081c8a86e6058b8990b927f2bb90903ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Xunit;
using System.IO;

namespace Mammoth.Tests {
	public class DocumentConverterTests {
		[Fact]
		public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() {
			assertSuccessfulConversion(
				convertToHtml("single-paragraph.docx"),
				"<p>Walking on imported air</p>");
		}

		private void assertSuccessfulConversion(IResult<string> result, string expectedValue) {
			Assert.Empty(result.Warnings);
			Assert.Equal(expectedValue, result.Value);
		}

		private IResult<string> convertToHtml(string name) {
			return new DocumentConverter().ConvertToHtml(TestFilePath(name));
		}

		private string TestFilePath(string name) {
			return Path.Combine("../../TestData", name);
		}
	}
}