From c3f394bb9b6a91ccde7b2255e46db463afc63652 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 7 May 2015 21:27:34 +0000 Subject: Use edge.js to run mammoth.js from .NET --- Mammoth.Tests/DocumentConverterTests.cs | 16 ++++ Mammoth.Tests/Mammoth.Tests.csproj | 96 ++++++++++++++++++++++ Mammoth.Tests/Properties/AssemblyInfo.cs | 36 ++++++++ Mammoth.Tests/TestDocuments/single-paragraph.docx | Bin 0 -> 12773 bytes Mammoth.Tests/packages.config | 5 ++ 5 files changed, 153 insertions(+) create mode 100644 Mammoth.Tests/DocumentConverterTests.cs create mode 100644 Mammoth.Tests/Mammoth.Tests.csproj create mode 100644 Mammoth.Tests/Properties/AssemblyInfo.cs create mode 100644 Mammoth.Tests/TestDocuments/single-paragraph.docx create mode 100644 Mammoth.Tests/packages.config (limited to 'Mammoth.Tests') diff --git a/Mammoth.Tests/DocumentConverterTests.cs b/Mammoth.Tests/DocumentConverterTests.cs new file mode 100644 index 0000000..9a977c5 --- /dev/null +++ b/Mammoth.Tests/DocumentConverterTests.cs @@ -0,0 +1,16 @@ +using NUnit.Framework; + +namespace Mammoth.Tests +{ + public class DocumentConverterTests + { + [Test] + public void SingleWordParagraphIsConvertedToSingleHtmlParagraph() + { + var documentConverter = new DocumentConverter(); + var result = documentConverter.ConvertToHtml("TestDocuments/single-paragraph.docx"); + Assert.AreEqual("

Walking on imported air

", result.Value); + Assert.IsEmpty(result.Messages); + } + } +} diff --git a/Mammoth.Tests/Mammoth.Tests.csproj b/Mammoth.Tests/Mammoth.Tests.csproj new file mode 100644 index 0000000..963e64c --- /dev/null +++ b/Mammoth.Tests/Mammoth.Tests.csproj @@ -0,0 +1,96 @@ + + + + + Debug + AnyCPU + {ED442448-256E-4574-BB1C-3303EF29B262} + Library + Properties + Mammoth.Tests + Mammoth.Tests + v4.0 + 512 + ..\ + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll + False + + + ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll + False + + + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + + ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll + False + + + ..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll + False + + + + + + + + + + + + + + + + + PreserveNewest + + + + + {7398c88c-cb94-41c3-bef9-755bcf81f373} + Mammoth + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Mammoth.Tests/Properties/AssemblyInfo.cs b/Mammoth.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c3c901e --- /dev/null +++ b/Mammoth.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Mammoth.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Mammoth.Tests")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ba4940f2-3760-4a66-b2a7-861164d661cc")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Mammoth.Tests/TestDocuments/single-paragraph.docx b/Mammoth.Tests/TestDocuments/single-paragraph.docx new file mode 100644 index 0000000..09caf9a Binary files /dev/null and b/Mammoth.Tests/TestDocuments/single-paragraph.docx differ diff --git a/Mammoth.Tests/packages.config b/Mammoth.Tests/packages.config new file mode 100644 index 0000000..af221c7 --- /dev/null +++ b/Mammoth.Tests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file -- cgit v1.2.3