-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathObjectDocumentConverterTests.cs
More file actions
48 lines (42 loc) · 1.25 KB
/
ObjectDocumentConverterTests.cs
File metadata and controls
48 lines (42 loc) · 1.25 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using AdaptiveTileExtensions.Support;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using System.Threading.Tasks;
using Windows.Data.Xml.Dom;
namespace AdaptiveTileExtensions.Testing
{
[TestClass]
public class ObjectDocumentConverterTests
{
[TestMethod]
public async Task Convert()
{
await Dispatch.OnPrimary( async () =>
{
await Defaults.Initialize();
Assert.IsNotNull( Defaults.Processor );
var document = new ObjectDocumentConverter().Convert( new Tile() );
var actual = document.GetXml();
Assert.AreEqual( Resources.ExpectedXml.Trim(), actual );
} );
}
[TestMethod]
public async Task Transform()
{
await Dispatch.OnPrimary( async () =>
{
await Defaults.Initialize();
Assert.IsNotNull( Defaults.Processor );
var document = new ObjectDocumentConverter().Convert( new Tile() );
var actual = Defaults.Processor.TransformToString( document );
Assert.AreEqual( ToXmlString( Resources.ExpectedTransform ), ToXmlString( actual ) );
} );
}
static string ToXmlString( string input )
{
var document = new XmlDocument();
document.LoadXml( input.Trim(), new XmlLoadSettings { ElementContentWhiteSpace = false } );
var result = document.GetXml();
return result;
}
}
}