main
cs 54 lines 2.01 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 Wix4ConversionFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void DoesNotAddFileId()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
19 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
20 " <Fragment>",
21 " <ComponentGroup Id='ProductComponents' Directory='INSTALLFOLDER'>",
22 " <Component>",
23 " <File Source='example.txt' />",
24 " </Component>",
25 " </ComponentGroup>",
26 " </Fragment>",
27 "</Wix>");
28
29 var expected = new[]
30 {
31 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
32 " <Fragment>",
33 " <ComponentGroup Id=\"ProductComponents\" Directory=\"INSTALLFOLDER\">",
34 " <Component>",
35 " <File Source=\"example.txt\" />",
36 " </Component>",
37 " </ComponentGroup>",
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(1, errors);
49
50 var actualLines = UnformattedDocumentLines(document);
51 WixAssert.CompareLineByLine(expected, actualLines);
52 }
53 }
54 }