aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.Converters/RegistryFixture.cs54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.Converters/RegistryFixture.cs b/src/test/WixToolsetTest.Converters/RegistryFixture.cs
new file mode 100644
index 00000000..405f5416
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/RegistryFixture.cs
@@ -0,0 +1,54 @@
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
3namespace WixToolsetTest.Converters
4{
5 using System;
6 using System.Xml.Linq;
7 using WixBuildTools.TestSupport;
8 using WixToolset.Converters;
9 using WixToolsetTest.Converters.Mocks;
10 using Xunit;
11
12 public class RegistryFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixRegistryKeyAction()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
19 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
20 " <Fragment>",
21 " <Component>",
22 " <RegistryKey Id='ExampleRegistryKey1' Action='create' Root='HKLM' Key='TestRegistryKey1' />",
23 " <RegistryKey Id='ExampleRegistryKey2' Action='createAndRemoveOnUninstall' Root='HKLM' Key='TestRegistryKey2' />",
24 " <RegistryKey Id='ExampleRegistryKey3' Action='none' Root='HKLM' Key='TestRegistryKey3' />",
25 " </Component>",
26 " </Fragment>",
27 "</Wix>");
28
29 var expected = new[]
30 {
31 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
32 " <Fragment>",
33 " <Component>",
34 " <RegistryKey Id=\"ExampleRegistryKey1\" Root=\"HKLM\" Key=\"TestRegistryKey1\" ForceCreateOnInstall=\"yes\" />",
35 " <RegistryKey Id=\"ExampleRegistryKey2\" Root=\"HKLM\" Key=\"TestRegistryKey2\" ForceCreateOnInstall=\"yes\" ForceDeleteOnUninstall=\"yes\" />",
36 " <RegistryKey Id=\"ExampleRegistryKey3\" Root=\"HKLM\" Key=\"TestRegistryKey3\" />",
37 " </Component>",
38 " </Fragment>",
39 "</Wix>"
40 };
41
42 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
43
44 var messaging = new MockMessaging();
45 var converter = new WixConverter(messaging, 2, null, null);
46
47 var errors = converter.ConvertDocument(document);
48 Assert.Equal(5, errors);
49
50 var actualLines = UnformattedDocumentLines(document);
51 WixAssert.CompareLineByLine(expected, actualLines);
52 }
53 }
54}