blob: 2421d73b5f59fbd161e654bc556a134dc193d5c4 (
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
28
29
30
31
32
33
|
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
namespace WixToolsetTest.Converters
{
using System;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Xunit;
public abstract class BaseConverterFixture
{
protected static string UnformattedDocumentString(XDocument document, bool omitXmlDeclaration = true)
{
var sb = new StringBuilder();
using (var writer = new StringWriter(sb))
using (var xml = XmlWriter.Create(writer, new XmlWriterSettings { OmitXmlDeclaration = omitXmlDeclaration }))
{
document.Save(xml);
}
return sb.ToString().TrimStart();
}
protected static string[] UnformattedDocumentLines(XDocument document, bool omitXmlDeclaration = true)
{
var unformatted = UnformattedDocumentString(document, omitXmlDeclaration);
return unformatted.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
}
}
}
|