blob: 5330305ec71b94327bd81bb7c311bee12d2c6809 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// 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.CoreIntegration
{
using System.Collections.Generic;
using WixToolset.Core.TestPackage;
using Xunit;
public class TestXmlFixture
{
[Fact]
public void ChangesIgnoredAttributesToStarToHelpMakeTestsLessFragile()
{
var original = @"<Top One='f'>
<First Two='t'>
<Target One='a' Two='b' Three='c' />
</First>
<Target One='z' Two='x' Three = 'y' />
</Top>";
var expected = "<Top One='f'><First Two='t'><Target One='*' Two='*' Three='c' /></First><Target One='*' Two='*' Three='y' /></Top>";
var ignored = new Dictionary<string, List<string>> { { "Target", new List<string> { "One", "Two", "Missing" } } };
Assert.Equal(expected, original.GetTestXml(ignored));
}
[Fact]
public void OutputsSingleQuotesSinceDoubleQuotesInCsharpLiteralStringsArePainful()
{
var original = "<Test Simple=\"\" EscapedDoubleQuote=\""\" SingleQuoteValue=\"'test'\" Alternating='\"' AlternatingEscaped='"' />";
var expected = "<Test Simple='' EscapedDoubleQuote='\"' SingleQuoteValue=''test'' Alternating='\"' AlternatingEscaped='\"' />";
Assert.Equal(expected, original.GetTestXml());
}
[Fact]
public void RemovesAllNamespacesToReduceTyping()
{
var original = "<Test xmlns='a'><Child xmlns:b='b'><Grandchild xmlns:c='c' /><Grandchild /></Child></Test>";
var expected = "<Test><Child><Grandchild /><Grandchild /></Child></Test>";
Assert.Equal(expected, original.GetTestXml());
}
[Fact]
public void RemovesUnnecessaryWhitespaceToAvoidLineEndingIssues()
{
var original = @"<Test>
<Child>
<Grandchild />
<Grandchild />
</Child>
</Test>";
var expected = "<Test><Child><Grandchild /><Grandchild /></Child></Test>";
Assert.Equal(expected, original.GetTestXml());
}
[Fact]
public void RemovesXmlDeclarationToReduceTyping()
{
var original = "<?xml version='1.0'?><Test />";
var expected = "<Test />";
Assert.Equal(expected, original.GetTestXml());
}
}
}
|