-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul Bentley
committed
Apr 11, 2019
1 parent
8763b86
commit 37890f9
Showing
5 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace OpenXmlFactory.Tests | ||
{ | ||
using Shouldly; | ||
using Xunit; | ||
|
||
public class OpenXmlElementReconstructorTests | ||
{ | ||
[Fact] | ||
public void Reconstruct() | ||
{ | ||
var constructor = new OpenXmlElementReconstructor(); | ||
var outerXml = "<w:p w:rsidRPr=\"00974A4B\" w:rsidR=\"00D3074F\" w:rsidP=\"00D3074F\" w:rsidRDefault=\"00974A4B\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"><w:pPr><w:pStyle w:val=\"Title\" /><w:pBdr><w:top w:val=\"single\" w:color=\"C0504D\" w:sz=\"48\" w:space=\"0\" /><w:bottom w:val=\"single\" w:color=\"C0504D\" w:sz=\"48\" w:space=\"0\" /></w:pBdr><w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"C0504D\" /><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" /><w:b /><w:iCs w:val=\"0\" /><w:color w:val=\"FFFFFF\" /><w:sz w:val=\"36\" /><w:szCs w:val=\"36\" /><w:lang w:val=\"nl-NL\" /></w:rPr></w:pPr><w:proofErr w:type=\"spellStart\" /><w:r w:rsidRPr=\"00974A4B\"><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" /><w:b /><w:iCs w:val=\"0\" /><w:smallCaps /><w:color w:val=\"FFFFFF\" /><w:sz w:val=\"36\" /><w:szCs w:val=\"36\" /><w:lang w:val=\"nl-NL\" /></w:rPr><w:t>Projectspecifieke</w:t></w:r><w:proofErr w:type=\"spellEnd\" /><w:r w:rsidRPr=\"00974A4B\"><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" /><w:b /><w:iCs w:val=\"0\" /><w:smallCaps /><w:color w:val=\"FFFFFF\" /><w:sz w:val=\"36\" /><w:szCs w:val=\"36\" /><w:lang w:val=\"nl-NL\" /></w:rPr><w:t xml:space=\"preserve\"> Voorwaarden</w:t></w:r></w:p>"; | ||
|
||
var element = constructor.Reconstruct(outerXml); | ||
|
||
element.GetType().ShouldBe(typeof(DocumentFormat.OpenXml.Wordprocessing.Paragraph)); | ||
element.LocalName.ShouldBe("p"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" /> | ||
<PackageReference Include="Shouldly" Version="3.0.2" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\OpenXmlFactory\OpenXmlFactory.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace OpenXmlFactory.Tests | ||
{ | ||
using Shouldly; | ||
using Xunit; | ||
|
||
public class OpenXmlTagExtractorTests | ||
{ | ||
[Fact] | ||
public void GetTagNamesByType() | ||
{ | ||
var extractor = new OpenXmlTagExtractor(); | ||
var tags = extractor.GetTagNamesByType(); | ||
|
||
tags.Count.ShouldBe(3440); | ||
tags.ShouldContain(e => e.Name == "p" && e.Namespace == "w"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace OpenXmlFactory.Tests | ||
{ | ||
using Shouldly; | ||
using Xunit; | ||
|
||
public class TagConverterTests | ||
{ | ||
[Fact] | ||
public void ConvertToTag() | ||
{ | ||
ITagConverter converter = new TagConverter(); | ||
|
||
var type = typeof(DocumentFormat.OpenXml.Wordprocessing.Paragraph); | ||
var tag = converter.ConvertToTag(type); | ||
|
||
tag.Name.ShouldBe("p"); | ||
tag.Namespace.ShouldBe("w"); | ||
tag.Type.ShouldBe(type); | ||
tag.TypeName.ShouldBe("DocumentFormat.OpenXml.Wordprocessing.Paragraph"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters