main
cs 49 lines 1.79 KB
Raw
1 // 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.
2
3 namespace WixToolsetTest.Converters
4 {
5 using System;
6 using System.Xml.Linq;
7 using WixInternal.TestSupport;
8 using WixToolset.Converters;
9 using WixToolsetTest.Converters.Mocks;
10 using Xunit;
11
12 public class SequenceFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixCondition()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
19 " <Fragment>",
20 " <InstallUISequence>",
21 " <Custom Action='ExampleCA' After='InstallFiles'>NOT Installed</Custom>",
22 " </InstallUISequence>",
23 " </Fragment>",
24 "</Wix>");
25
26 var expected = new[]
27 {
28 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
29 " <Fragment>",
30 " <InstallUISequence>",
31 " <Custom Action=\"ExampleCA\" After=\"InstallFiles\" Condition=\"NOT Installed\" />",
32 " </InstallUISequence>",
33 " </Fragment>",
34 "</Wix>"
35 };
36
37 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
38
39 var messaging = new MockMessaging();
40 var converter = new WixConverter(messaging, 2, null, null);
41
42 var errors = converter.ConvertDocument(document);
43 Assert.Equal(2, errors);
44
45 var actualLines = UnformattedDocumentLines(document);
46 WixAssert.CompareLineByLine(expected, actualLines);
47 }
48 }
49 }