diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-05-07 21:27:34 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-05-07 21:27:34 +0000 |
| commit | c3f394bb9b6a91ccde7b2255e46db463afc63652 (patch) | |
| tree | e3e5d670be450ed774f0fb0ca587a3bde53fa4b8 /Mammoth.Tests | |
Use edge.js to run mammoth.js from .NET
Diffstat (limited to 'Mammoth.Tests')
| -rw-r--r-- | Mammoth.Tests/DocumentConverterTests.cs | 16 | ||||
| -rw-r--r-- | Mammoth.Tests/Mammoth.Tests.csproj | 96 | ||||
| -rw-r--r-- | Mammoth.Tests/Properties/AssemblyInfo.cs | 36 | ||||
| -rw-r--r-- | Mammoth.Tests/TestDocuments/single-paragraph.docx | bin | 0 -> 12773 bytes | |||
| -rw-r--r-- | Mammoth.Tests/packages.config | 5 |
5 files changed, 153 insertions, 0 deletions
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("<p>Walking on imported air</p>", 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{ED442448-256E-4574-BB1C-3303EF29B262}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Mammoth.Tests</RootNamespace> + <AssemblyName>Mammoth.Tests</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> + <RestorePackages>true</RestorePackages> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="nunit.core"> + <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath> + <Private>False</Private> + </Reference> + <Reference Include="nunit.core.interfaces"> + <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll</HintPath> + <Private>False</Private> + </Reference> + <Reference Include="nunit.framework"> + <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath> + </Reference> + <Reference Include="nunit.util"> + <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll</HintPath> + <Private>False</Private> + </Reference> + <Reference Include="NUnit.VisualStudio.TestAdapter"> + <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath> + <Private>False</Private> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="DocumentConverterTests.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + <None Include="TestDocuments\single-paragraph.docx"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Mammoth\Mammoth.csproj"> + <Project>{7398c88c-cb94-41c3-bef9-755bcf81f373}</Project> + <Name>Mammoth</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>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}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" /> + </Target> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ 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 Binary files differnew file mode 100644 index 0000000..09caf9a --- /dev/null +++ b/Mammoth.Tests/TestDocuments/single-paragraph.docx 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="NUnit" version="2.6.4" targetFramework="net40" /> + <package id="NUnitTestAdapter" version="2.0.0" targetFramework="net40" /> +</packages>
\ No newline at end of file |
