main
cs 49 lines 1.88 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 VSExtensionFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixVsLocatorPropertyRefs()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
19 " <Fragment>",
20 " <PropertyRef Id=\"VS2019_ROOT_FOLDER\" />",
21 " <PropertyRef Id=\"VS2022_BOOTSTRAPPER_PACKAGE_FOLDER\" />",
22 " <CustomActionRef Id=\"VS2017Setup\" />",
23 " </Fragment>",
24 "</Wix>");
25
26 var expected = new[]
27 {
28 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:vs=\"http://wixtoolset.org/schemas/v4/wxs/vs\">",
29 " <Fragment>",
30 " <vs:FindVisualStudio />",
31 " <PropertyRef Id=\"VS2022_BOOTSTRAPPER_PACKAGE_FOLDER\" />",
32 " <CustomActionRef Id=\"VS2017Setup\" />",
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(3, errors);
44
45 var actualLines = UnformattedDocumentLines(document);
46 WixAssert.CompareLineByLine(expected, actualLines);
47 }
48 }
49 }