diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-06-27 22:55:44 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-06-27 22:59:20 -0700 |
| commit | c8e5b2b045b35bd6e5b8b2021a3173df16500887 (patch) | |
| tree | d8f191dd3cc939e81fca73d631d9f227f4d0331b /src/test | |
| parent | f17f7138de534891a2605c9a86c0acc36cc41154 (diff) | |
| download | wix-c8e5b2b045b35bd6e5b8b2021a3173df16500887.tar.gz wix-c8e5b2b045b35bd6e5b8b2021a3173df16500887.tar.bz2 wix-c8e5b2b045b35bd6e5b8b2021a3173df16500887.zip | |
Correctly detect wix4 for better conversions
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/WixToolsetTest.Converters/ConverterFixture.cs | 4 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs | 53 |
2 files changed, 55 insertions, 2 deletions
diff --git a/src/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/test/WixToolsetTest.Converters/ConverterFixture.cs index c205df39..6e2ad2c5 100644 --- a/src/test/WixToolsetTest.Converters/ConverterFixture.cs +++ b/src/test/WixToolsetTest.Converters/ConverterFixture.cs | |||
| @@ -331,7 +331,7 @@ namespace WixToolsetTest.Converters | |||
| 331 | { | 331 | { |
| 332 | var parse = String.Join(Environment.NewLine, | 332 | var parse = String.Join(Environment.NewLine, |
| 333 | "<?xml version='1.0' encoding='utf-8'?>", | 333 | "<?xml version='1.0' encoding='utf-8'?>", |
| 334 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | 334 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", |
| 335 | " <File Source='path\\to\\foo.txt' />", | 335 | " <File Source='path\\to\\foo.txt' />", |
| 336 | "</Wix>"); | 336 | "</Wix>"); |
| 337 | 337 | ||
| @@ -349,7 +349,7 @@ namespace WixToolsetTest.Converters | |||
| 349 | 349 | ||
| 350 | var actual = UnformattedDocumentString(document); | 350 | var actual = UnformattedDocumentString(document); |
| 351 | 351 | ||
| 352 | Assert.Equal(2, errors); | 352 | Assert.Equal(3, errors); |
| 353 | Assert.Equal(expected, actual); | 353 | Assert.Equal(expected, actual); |
| 354 | } | 354 | } |
| 355 | 355 | ||
diff --git a/src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs b/src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs new file mode 100644 index 00000000..a3f2adc8 --- /dev/null +++ b/src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs | |||
| @@ -0,0 +1,53 @@ | |||
| 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 WixToolset.Converters; | ||
| 8 | using WixToolsetTest.Converters.Mocks; | ||
| 9 | using Xunit; | ||
| 10 | |||
| 11 | public class Wix4ConversionFixture : BaseConverterFixture | ||
| 12 | { | ||
| 13 | [Fact] | ||
| 14 | public void DoesNotAddFileId() | ||
| 15 | { | ||
| 16 | var parse = String.Join(Environment.NewLine, | ||
| 17 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", | ||
| 18 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
| 19 | " <Fragment>", | ||
| 20 | " <ComponentGroup Id='ProductComponents' Directory='INSTALLFOLDER'>", | ||
| 21 | " <Component>", | ||
| 22 | " <File Source='example.txt' />", | ||
| 23 | " </Component>", | ||
| 24 | " </ComponentGroup>", | ||
| 25 | " </Fragment>", | ||
| 26 | "</Wix>"); | ||
| 27 | |||
| 28 | var expected = new[] | ||
| 29 | { | ||
| 30 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 31 | " <Fragment>", | ||
| 32 | " <ComponentGroup Id=\"ProductComponents\" Directory=\"INSTALLFOLDER\">", | ||
| 33 | " <Component>", | ||
| 34 | " <File Source=\"example.txt\" />", | ||
| 35 | " </Component>", | ||
| 36 | " </ComponentGroup>", | ||
| 37 | " </Fragment>", | ||
| 38 | "</Wix>" | ||
| 39 | }; | ||
| 40 | |||
| 41 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 42 | |||
| 43 | var messaging = new MockMessaging(); | ||
| 44 | var converter = new WixConverter(messaging, 2, null, null); | ||
| 45 | |||
| 46 | var errors = converter.ConvertDocument(document); | ||
| 47 | Assert.Equal(1, errors); | ||
| 48 | |||
| 49 | var actualLines = UnformattedDocumentLines(document); | ||
| 50 | CompareLineByLine(expected, actualLines); | ||
| 51 | } | ||
| 52 | } | ||
| 53 | } | ||
