From 612dc390ecd90bf4079ad7545f4a4832ce8f702d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 27 Apr 2021 22:37:33 -0700 Subject: Move Converters into wix --- .../BaseConverterFixture.cs | 33 -- .../WixToolsetTest.Converters/BitnessFixture.cs | 187 --------- .../BootstrapperApplicationFixture.cs | 418 ------------------- .../WixToolsetTest.Converters/ConditionFixture.cs | 297 -------------- .../WixToolsetTest.Converters/ConverterFixture.cs | 449 --------------------- .../ConverterIntegrationFixture.cs | 195 --------- .../CustomActionFixture.cs | 88 ---- .../CustomTableFixture.cs | 363 ----------------- .../WixToolsetTest.Converters/DependencyFixture.cs | 178 -------- .../WixToolsetTest.Converters/DirectoryFixture.cs | 92 ----- .../WixToolsetTest.Converters/ExePackageFixture.cs | 49 --- .../WixToolsetTest.Converters/FeatureFixture.cs | 110 ----- .../FirewallExtensionFixture.cs | 47 --- .../WixToolsetTest.Converters/FormatFixture.cs | 117 ------ .../WixToolsetTest.Converters/IncludeFixture.cs | 68 ---- .../Mocks/MockCoreServiceProvider.cs | 51 --- .../Mocks/MockMessaging.cs | 39 -- .../ProductPackageFixture.cs | 278 ------------- .../WixToolsetTest.Converters/PropertyFixture.cs | 108 ----- .../WixToolsetTest.Converters/RegistryFixture.cs | 54 --- .../RemotePayloadFixture.cs | 104 ----- .../WixToolsetTest.Converters/SequenceFixture.cs | 49 --- src/test/WixToolsetTest.Converters/TagFixture.cs | 111 ----- .../PackageSummaryInformation/TypicalV3.msi | Bin 32768 -> 0 bytes .../PackageSummaryInformation/TypicalV3.wxs | 37 -- .../TestData/PermissionEx/v3.wxs | 26 -- .../TestData/PermissionEx/v4_expected.wxs | 26 -- .../Preprocessor/ConvertedPreprocessor.wxs | 61 --- .../TestData/Preprocessor/Preprocessor.wxs | 63 --- .../TestData/Preprocessor/wixcop.settings.xml | 9 - .../TestData/QtExec.bad/v3.wxs | 64 --- .../TestData/QtExec.bad/v4_expected.wxs | 63 --- .../TestData/QtExec/v3.wxs | 64 --- .../TestData/QtExec/v4_expected.wxs | 62 --- .../TestData/SingleFile/ConvertedSingleFile.wxs | 59 --- .../TestData/SingleFile/SingleFile.wxs | 61 --- .../UtilExtensionFixture.cs | 190 --------- .../WixToolsetTest.Converters/VariableFixture.cs | 86 ---- .../Wix4ConversionFixture.cs | 54 --- .../WixToolsetTest.Converters.csproj | 31 -- 40 files changed, 4441 deletions(-) delete mode 100644 src/test/WixToolsetTest.Converters/BaseConverterFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/BitnessFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/ConditionFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/ConverterFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/CustomActionFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/CustomTableFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/DependencyFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/DirectoryFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/ExePackageFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/FeatureFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/FormatFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/IncludeFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/Mocks/MockCoreServiceProvider.cs delete mode 100644 src/test/WixToolsetTest.Converters/Mocks/MockMessaging.cs delete mode 100644 src/test/WixToolsetTest.Converters/ProductPackageFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/PropertyFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/RegistryFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/SequenceFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/TagFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.msi delete mode 100644 src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.wxs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/PermissionEx/v3.wxs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/PermissionEx/v4_expected.wxs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.wxs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml delete mode 100644 src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v3.wxs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/QtExec/v3.wxs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs delete mode 100644 src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs delete mode 100644 src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/VariableFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs delete mode 100644 src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj (limited to 'src/test/WixToolsetTest.Converters') diff --git a/src/test/WixToolsetTest.Converters/BaseConverterFixture.cs b/src/test/WixToolsetTest.Converters/BaseConverterFixture.cs deleted file mode 100644 index 2421d73b..00000000 --- a/src/test/WixToolsetTest.Converters/BaseConverterFixture.cs +++ /dev/null @@ -1,33 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.IO; - using System.Text; - using System.Xml; - using System.Xml.Linq; - using Xunit; - - public abstract class BaseConverterFixture - { - protected static string UnformattedDocumentString(XDocument document, bool omitXmlDeclaration = true) - { - var sb = new StringBuilder(); - - using (var writer = new StringWriter(sb)) - using (var xml = XmlWriter.Create(writer, new XmlWriterSettings { OmitXmlDeclaration = omitXmlDeclaration })) - { - document.Save(xml); - } - - return sb.ToString().TrimStart(); - } - - protected static string[] UnformattedDocumentLines(XDocument document, bool omitXmlDeclaration = true) - { - var unformatted = UnformattedDocumentString(document, omitXmlDeclaration); - return unformatted.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/BitnessFixture.cs b/src/test/WixToolsetTest.Converters/BitnessFixture.cs deleted file mode 100644 index e45a9388..00000000 --- a/src/test/WixToolsetTest.Converters/BitnessFixture.cs +++ /dev/null @@ -1,187 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class BitnessFixture : BaseConverterFixture - { - [Fact] - public void FixComponentBitness() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(10, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixRegistrySearchBitness() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(4, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixUtilRegistrySearchBitness() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(6, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixApprovedExeBitness() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(4, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs b/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs deleted file mode 100644 index 158ab3be..00000000 --- a/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs +++ /dev/null @@ -1,418 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class BootstrapperApplicationFixture : BaseConverterFixture - { - [Fact] - public void CantCreateBootstrapperApplicationDllFromV3PayloadGroupRef() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(2, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void ConvertDotNetCoreBootstrapperApplicationRefWithExistingElement() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(1, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void ConvertDotNetCoreBootstrapperApplicationRefWithoutExistingElement() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - "", - "", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(1, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void ConvertFrameworkBootstrapperApplicationRefWithExistingElement() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void ConvertFrameworkBootstrapperApplicationRefWithoutExistingElement() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - "", - "", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void ConvertStandardBootstrapperApplicationRefWithExistingElement() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void ConvertStandardBootstrapperApplicationRefWithoutExistingElement() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - "", - "", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void CreateBootstrapperApplicationDllFromV3() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - "", - "", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void CreateBootstrapperApplicationDllFromV3Payload() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - "", - "", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void DoesntSetDpiUnawareFromV4() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(0, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void KeepsDpiAwarenessFromV4() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - "", - "", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(1, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void RemovesBalUseUILanguages() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(5, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/ConditionFixture.cs b/src/test/WixToolsetTest.Converters/ConditionFixture.cs deleted file mode 100644 index d3f65aeb..00000000 --- a/src/test/WixToolsetTest.Converters/ConditionFixture.cs +++ /dev/null @@ -1,297 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class ConditionFixture : BaseConverterFixture - { - [Fact] - public void FixControlCondition() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " x=y", - " a<>b", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(4, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixPublishCondition() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " 1<2", - " 1", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(5, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixComponentCondition() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " 1<2", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixFeatureCondition() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " PROP = 1", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixLaunchCondition() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " 1<2", - " ", - " ", - " 1=2", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(4, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixLaunchConditionInProduct() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " 1<2", - " ", - " ", - " 1=2", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(6, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixPermissionExCondition() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " 1<2", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/test/WixToolsetTest.Converters/ConverterFixture.cs deleted file mode 100644 index 13df9da7..00000000 --- a/src/test/WixToolsetTest.Converters/ConverterFixture.cs +++ /dev/null @@ -1,449 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class ConverterFixture : BaseConverterFixture - { - private static readonly XNamespace Wix4Namespace = "http://wixtoolset.org/schemas/v4/wxs"; - - [Fact] - public void EnsuresNoDeclaration() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(1, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void EnsuresDeclarationWhenIgnored() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, ignoreErrors: new[] { "DeclarationPresent" } ); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document, omitXmlDeclaration: false); - - Assert.Equal(0, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertMainNamespace() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - //Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace()); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertNamedMainNamespace() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - Assert.Equal(expected, actual); - Assert.Equal(Wix4Namespace, document.Root.GetNamespaceOfPrefix("w")); - } - - [Fact] - public void CanConvertNonWixDefaultNamespace() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(expected, actual); - Assert.Equal(3, errors); - Assert.Equal(Wix4Namespace, document.Root.GetNamespaceOfPrefix("w")); - Assert.Equal("http://wixtoolset.org/schemas/v4/wxs/util", document.Root.GetDefaultNamespace()); - } - - [Fact] - public void CanRemoveUnusedNamespaces() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(4, errors); - Assert.Equal(expected, actual); - Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace()); - } - - [Fact] - public void CanConvertMissingWixNamespace() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - Assert.Equal(expected, actual); - Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace()); - } - - [Fact] - public void CanConvertMissingIncludeNamespace() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - Assert.Equal(expected, actual); - Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace()); - } - - [Fact] - public void CanConvertAnonymousFile() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(3, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertShortNameDirectoryWithoutName() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertCatalogElement() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(1, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertSuppressSignatureValidationNo() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(1, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertSuppressSignatureValidationYes() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(1, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CantConvertVerbTarget() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertDeprecatedPrefix() - { - var parse = String.Join(Environment.NewLine, - "", - "", - "", - "", - "", - "", - "", - "", - ""); - - var expected = String.Join(Environment.NewLine, - "", - "", - "", - "", - "", - "", - "", - "", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(3, errors); - Assert.Equal(expected, actual); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs b/src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs deleted file mode 100644 index a39f6243..00000000 --- a/src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs +++ /dev/null @@ -1,195 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.IO; - using System.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolset.Core; - using WixToolset.Core.TestPackage; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class ConverterIntegrationFixture - { - [Fact] - public void CanConvertPermissionExFile() - { - const string beforeFileName = "v3.wxs"; - const string afterFileName = "v4_expected.wxs"; - var folder = TestData.Get(@"TestData\PermissionEx"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(true); - var targetFile = Path.Combine(baseFolder, beforeFileName); - File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName)); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 4); - var errors = converter.ConvertFile(targetFile, true); - - Assert.Equal(8, errors); - - var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n"); - var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n"); - Assert.Equal(expected, actual); - - EnsureFixed(targetFile); - } - } - - [Fact] - public void CanConvertSingleFile() - { - const string beforeFileName = "SingleFile.wxs"; - const string afterFileName = "ConvertedSingleFile.wxs"; - var folder = TestData.Get(@"TestData\SingleFile"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(true); - var targetFile = Path.Combine(baseFolder, beforeFileName); - File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName)); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 4); - var errors = converter.ConvertFile(targetFile, true); - - Assert.Equal(9, errors); - - var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n"); - var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n"); - Assert.Equal(expected, actual); - - EnsureFixed(targetFile); - } - } - - [Fact] - public void CanDetectReadOnlyOutputFile() - { - const string beforeFileName = "SingleFile.wxs"; - var folder = TestData.Get(@"TestData\SingleFile"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(true); - var targetFile = Path.Combine(baseFolder, beforeFileName); - File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName)); - - var info = new FileInfo(targetFile); - info.IsReadOnly = true; - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 4); - var errors = converter.ConvertFile(targetFile, true); - - Assert.Single(messaging.Messages.Where(m => m.Id == 5/*WixConverter.ConverterTestType.UnauthorizedAccessException*/)); - } - } - - [Fact] - public void RetainsPreprocessorInstructions() - { - const string beforeFileName = "Preprocessor.wxs"; - const string afterFileName = "ConvertedPreprocessor.wxs"; - var folder = TestData.Get(@"TestData\Preprocessor"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(true); - var targetFile = Path.Combine(baseFolder, beforeFileName); - File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName)); - - var settingsFile = Path.Combine(folder, "wixcop.settings.xml"); - - var result = RunConversion(targetFile, settingsFile: settingsFile); - Assert.Equal(9, result.ExitCode); - - var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n"); - var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n"); - Assert.Equal(expected, actual); - - EnsureFixed(targetFile); - } - } - - [Fact] - public void CanConvertQtExec() - { - const string beforeFileName = "v3.wxs"; - const string afterFileName = "v4_expected.wxs"; - var folder = TestData.Get(@"TestData\QtExec"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(true); - var targetFile = Path.Combine(baseFolder, beforeFileName); - File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName)); - - var result = RunConversion(targetFile); - Assert.Equal(13, result.ExitCode); - - var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n"); - var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n"); - Assert.Equal(expected, actual); - - EnsureFixed(targetFile); - } - } - - [Fact] - public void DetectUnconvertableQtExecCmdTimeout() - { - const string beforeFileName = "v3.wxs"; - const string afterFileName = "v4_expected.wxs"; - var folder = TestData.Get(@"TestData\QtExec.bad"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(true); - var targetFile = Path.Combine(baseFolder, beforeFileName); - File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName)); - - var result = RunConversion(targetFile); - - Assert.Equal(13, result.ExitCode); - Assert.Single(result.Messages.Where(message => message.ToString().EndsWith("(QtExecCmdTimeoutAmbiguous)"))); - - var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n"); - var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n"); - Assert.Equal(expected, actual); - - // still fails because QtExecCmdTimeoutAmbiguous is unfixable - var result2 = RunConversion(targetFile); - Assert.Equal(1, result2.ExitCode); - } - } - - private static WixRunnerResult RunConversion(string targetFile, bool fixErrors = true, string settingsFile = null) - { - var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider().AddConverter(); - - var exitCode = WixRunner.Execute(new[] - { - "convert", - fixErrors ? null : "--dry-run", - String.IsNullOrEmpty(settingsFile) ? null : "-set1" + settingsFile, - targetFile - }, serviceProvider, out var messages); - - return new WixRunnerResult { ExitCode = exitCode.Result, Messages = messages.ToArray() }; - } - - private static void EnsureFixed(string targetFile) - { - var messaging2 = new MockMessaging(); - var converter2 = new WixConverter(messaging2, 4); - var errors2 = converter2.ConvertFile(targetFile, true); - Assert.Equal(0, errors2); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/CustomActionFixture.cs b/src/test/WixToolsetTest.Converters/CustomActionFixture.cs deleted file mode 100644 index eafc171a..00000000 --- a/src/test/WixToolsetTest.Converters/CustomActionFixture.cs +++ /dev/null @@ -1,88 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.IO; - using System.Xml.Linq; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class CustomActionFixture : BaseConverterFixture - { - [Fact] - public void CanConvertCustomAction() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(11, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertCustomActionScript() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " function() {", - " var x = 0;", - " return x;", - " }", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var expectedScript = String.Join("\n", - "function() {", - " var x = 0;", - " return x;", - " }"); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - Assert.Equal(expected, actual); - - var script = File.ReadAllText("Foo.js"); - Assert.Equal(expectedScript, script); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/CustomTableFixture.cs b/src/test/WixToolsetTest.Converters/CustomTableFixture.cs deleted file mode 100644 index 2b81a863..00000000 --- a/src/test/WixToolsetTest.Converters/CustomTableFixture.cs +++ /dev/null @@ -1,363 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class CustomTableFixture : BaseConverterFixture - { - [Fact] - public void FixCustomTableCategoryAndModularization() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(4, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixCustomRowTextValue() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " Some value", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(4, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixCustomRowCdataValue() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixCustomRowWithoutValue() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void CanConvertBundleCustomTableBootstrapperApplicationData() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " Row1", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, customTableTarget: CustomTableTarget.Bundle); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertBundleCustomTableRef() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " Row1", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, customTableTarget: CustomTableTarget.Bundle); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertMsiCustomTableBootstrapperApplicationData() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " Row1", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, customTableTarget: CustomTableTarget.Msi); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanConvertMsiCustomTableRef() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " Row1", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, customTableTarget: CustomTableTarget.Msi); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(2, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanDetectAmbiguousCustomTableBootstrapperApplicationData() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(1, errors); - Assert.Equal(expected, actual); - } - - [Fact] - public void CanRemoveBootstrapperApplicationDataFromRealCustomTable() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(1, errors); - Assert.Equal(expected, actual); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/DependencyFixture.cs b/src/test/WixToolsetTest.Converters/DependencyFixture.cs deleted file mode 100644 index 41ded927..00000000 --- a/src/test/WixToolsetTest.Converters/DependencyFixture.cs +++ /dev/null @@ -1,178 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class DependencyFixture : BaseConverterFixture - { - [Fact] - public void FixPackageDependencyProvides() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(5, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixPackageDependencyRequires() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(7, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixPackageDependencyRequiresRef() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(7, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixBundleDependencyProvides() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(5, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/DirectoryFixture.cs b/src/test/WixToolsetTest.Converters/DirectoryFixture.cs deleted file mode 100644 index 3c906320..00000000 --- a/src/test/WixToolsetTest.Converters/DirectoryFixture.cs +++ /dev/null @@ -1,92 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class DirectoryFixture : BaseConverterFixture - { - [Fact] - public void RemoveTargetDir() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixStandardDirectory() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(4, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/ExePackageFixture.cs b/src/test/WixToolsetTest.Converters/ExePackageFixture.cs deleted file mode 100644 index 0ee8d065..00000000 --- a/src/test/WixToolsetTest.Converters/ExePackageFixture.cs +++ /dev/null @@ -1,49 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class ExePackageFixture : BaseConverterFixture - { - [Fact] - public void CanConvertExePackageCommandToArguments() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/FeatureFixture.cs b/src/test/WixToolsetTest.Converters/FeatureFixture.cs deleted file mode 100644 index 1df94a81..00000000 --- a/src/test/WixToolsetTest.Converters/FeatureFixture.cs +++ /dev/null @@ -1,110 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class FeatureFixture : BaseConverterFixture - { - [Fact] - public void FixAllowAttributes() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(4, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixDisallowAttributes() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void RemoveDeprecatedAllowAdvertiseAttributes() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs b/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs deleted file mode 100644 index a101019b..00000000 --- a/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class FirewallExtensionFixture : BaseConverterFixture - { - [Fact] - public void FixRemoteAddressValue() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " 127.0.0.1", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/FormatFixture.cs b/src/test/WixToolsetTest.Converters/FormatFixture.cs deleted file mode 100644 index 739fba66..00000000 --- a/src/test/WixToolsetTest.Converters/FormatFixture.cs +++ /dev/null @@ -1,117 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class FormatFixture : BaseConverterFixture - { - [Fact] - public void CanFixWhitespace() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 4, null, null); - - var errors = converter.FormatDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(expected, actual); - Assert.Equal(5, errors); - } - - [Fact] - public void CanPreserveNewLines() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - "", - " ", - "", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - "", - " ", - "", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 4, null, null); - - var conversions = converter.FormatDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(expected, actual); - Assert.Equal(4, conversions); - } - - [Fact] - public void CanFormatWithNewLineAtEndOfFile() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - "", - " ", - "", - " ", - "", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - "", - " ", - "", - " ", - "", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 4, null, null); - - var conversions = converter.FormatDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(expected, actual); - Assert.Equal(3, conversions); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/IncludeFixture.cs b/src/test/WixToolsetTest.Converters/IncludeFixture.cs deleted file mode 100644 index 2fd8244f..00000000 --- a/src/test/WixToolsetTest.Converters/IncludeFixture.cs +++ /dev/null @@ -1,68 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class IncludeFixture : BaseConverterFixture - { - [Fact] - public void EnsureNamespace() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - ""); - - var expected = new[] - { - "", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(1, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixNamespace() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - ""); - - var expected = new[] - { - "", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(1, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/Mocks/MockCoreServiceProvider.cs b/src/test/WixToolsetTest.Converters/Mocks/MockCoreServiceProvider.cs deleted file mode 100644 index b6bb8a40..00000000 --- a/src/test/WixToolsetTest.Converters/Mocks/MockCoreServiceProvider.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters.Mocks -{ - using System; - using System.Collections.Generic; - using WixToolset.Extensibility.Services; - - public class MockCoreServiceProvider : IWixToolsetCoreServiceProvider - { - public Dictionary, object>> CreationFunctions { get; } = new Dictionary, object>>(); - - public Dictionary Singletons { get; } = new Dictionary() - { - { typeof(IMessaging), new MockMessaging() } - }; - - public void AddService(Type serviceType, Func, object> creationFunction) => this.CreationFunctions.Add(serviceType, creationFunction); - - public void AddService(Func, T> creationFunction) where T : class => this.AddService(typeof(T), creationFunction); - - public T GetService() where T : class => this.TryGetService(typeof(T), out var obj) ? (T)obj : null; - - public object GetService(Type serviceType) => this.TryGetService(serviceType, out var service) ? service : null; - - public bool TryGetService(Type serviceType, out object service) - { - if (!this.Singletons.TryGetValue(serviceType, out service)) - { - if (this.CreationFunctions.TryGetValue(serviceType, out var creationFunction)) - { - service = creationFunction(this, this.Singletons); - } - } - - return service != null; - } - - public bool TryGetService(out T service) where T : class - { - service = null; - - if (this.TryGetService(typeof(T), out var obj)) - { - service = (T)obj; - } - - return service != null; - } - } -} \ No newline at end of file diff --git a/src/test/WixToolsetTest.Converters/Mocks/MockMessaging.cs b/src/test/WixToolsetTest.Converters/Mocks/MockMessaging.cs deleted file mode 100644 index 77821a1c..00000000 --- a/src/test/WixToolsetTest.Converters/Mocks/MockMessaging.cs +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters.Mocks -{ - using System; - using System.Collections.Generic; - using WixToolset.Data; - using WixToolset.Extensibility; - using WixToolset.Extensibility.Services; - - public class MockMessaging : IMessaging - { - public List Messages { get; } = new List(); - - public bool EncounteredError { get; private set; } - - public int LastErrorNumber { get; } - - public bool ShowVerboseMessages { get; set; } - - public bool SuppressAllWarnings { get; set; } - - public bool WarningsAsError { get; set; } - - public void ElevateWarningMessage(int warningNumber) => throw new NotImplementedException(); - - public void SetListener(IMessageListener listener) => throw new NotImplementedException(); - - public void SuppressWarningMessage(int warningNumber) => throw new NotImplementedException(); - - public void Write(Message message) - { - this.Messages.Add(message); - this.EncounteredError |= message.Level == MessageLevel.Error; - } - - public void Write(string message, bool verbose = false) => throw new NotImplementedException(); - } -} diff --git a/src/test/WixToolsetTest.Converters/ProductPackageFixture.cs b/src/test/WixToolsetTest.Converters/ProductPackageFixture.cs deleted file mode 100644 index e01b9789..00000000 --- a/src/test/WixToolsetTest.Converters/ProductPackageFixture.cs +++ /dev/null @@ -1,278 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.IO; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolset.Core.TestPackage; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class ProductPackageFixture : BaseConverterFixture - { - [Fact] - public void FixesCompressedWhenYes() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - AssertSuccess(parse, 4, expected); - } - - [Fact] - public void FixesCompressedWhenNo() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - AssertSuccess(parse, 4, expected); - } - - [Fact] - public void FixesCompressedWhenOmitted() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - AssertSuccess(parse, 4, expected); - } - - private static void AssertSuccess(string input, int expectedErrorCount, string[] expected) - { - var document = XDocument.Parse(input, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(expectedErrorCount, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixesInstallerVersion() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - AssertSuccess(parse, 3, expected); - } - - [Fact] - public void FixesDefaultInstallerVersion() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - AssertSuccess(parse, 3, expected); - } - - [Fact] - public void FixesImplicitInstallerVersion() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - AssertSuccess(parse, 4, expected); - } - - [Fact] - public void FixesNonDefaultInstallerVersion() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - AssertSuccess(parse, 3, expected); - } - - [Fact] - public void FixesLimitedInstallerPrivileges() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - AssertSuccess(parse, 4, expected); - } - - [Fact] - public void FixesElevatedInstallerPrivileges() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - "" - }; - - AssertSuccess(parse, 4, expected); - } - - [Fact] - public void CanDecompileAndRecompile() - { - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var intermediateFolder = Path.Combine(baseFolder, "obj"); - var decompiledWxsPath = Path.Combine(baseFolder, "TypicalV3.wxs"); - - var folder = TestData.Get(@"TestData\PackageSummaryInformation"); - var v3msiPath = Path.Combine(folder, "TypicalV3.msi"); - var result = WixRunner.Execute(new[] - { - "decompile", v3msiPath, - "-intermediateFolder", intermediateFolder, - "-o", decompiledWxsPath - }); - - result.AssertSuccess(); - - var v4msiPath = Path.Combine(intermediateFolder, "TypicalV4.msi"); - result = WixRunner.Execute(new[] - { - "build", decompiledWxsPath, - "-arch", "x64", - "-intermediateFolder", intermediateFolder, - "-o", v4msiPath - }); - - result.AssertSuccess(); - - Assert.True(File.Exists(v4msiPath)); - - var v3results = Query.QueryDatabase(v3msiPath, new[] { "_SummaryInformation", "Property" }); - var v4results = Query.QueryDatabase(v4msiPath, new[] { "_SummaryInformation", "Property" }); - WixAssert.CompareLineByLine(v3results, v4results); - } - } - } -} diff --git a/src/test/WixToolsetTest.Converters/PropertyFixture.cs b/src/test/WixToolsetTest.Converters/PropertyFixture.cs deleted file mode 100644 index e50a6518..00000000 --- a/src/test/WixToolsetTest.Converters/PropertyFixture.cs +++ /dev/null @@ -1,108 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class PropertyFixture : BaseConverterFixture - { - [Fact] - public void CanFixCdataWhitespace() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(expected, actual); - Assert.Equal(1, errors); - } - - [Fact] - public void CanFixCdataWithWhitespace() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(expected, actual); - Assert.Equal(1, errors); - } - - [Fact] - public void CanKeepCdataWithOnlyWhitespace() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var expected = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - var errors = converter.ConvertDocument(document); - - var actual = UnformattedDocumentString(document); - - Assert.Equal(expected, actual); - Assert.Equal(1, errors); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/RegistryFixture.cs b/src/test/WixToolsetTest.Converters/RegistryFixture.cs deleted file mode 100644 index 405f5416..00000000 --- a/src/test/WixToolsetTest.Converters/RegistryFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class RegistryFixture : BaseConverterFixture - { - [Fact] - public void FixRegistryKeyAction() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(5, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs b/src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs deleted file mode 100644 index b2640e13..00000000 --- a/src/test/WixToolsetTest.Converters/RemotePayloadFixture.cs +++ /dev/null @@ -1,104 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class RemotePayloadFixture : BaseConverterFixture - { - [Fact] - public void CanConvertExePackageRemotePayload() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(6, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void CanConvertMsuPackageRemotePayload() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(5, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/SequenceFixture.cs b/src/test/WixToolsetTest.Converters/SequenceFixture.cs deleted file mode 100644 index ec6c709b..00000000 --- a/src/test/WixToolsetTest.Converters/SequenceFixture.cs +++ /dev/null @@ -1,49 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class SequenceFixture : BaseConverterFixture - { - [Fact] - public void FixCondition() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " NOT Installed", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(2, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/TagFixture.cs b/src/test/WixToolsetTest.Converters/TagFixture.cs deleted file mode 100644 index 5e07c83b..00000000 --- a/src/test/WixToolsetTest.Converters/TagFixture.cs +++ /dev/null @@ -1,111 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class TagFixture : BaseConverterFixture - { - [Fact] - public void FixTagExtension() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(4, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixTagExtensionDeprecations() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(7, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixTagExtensionTagRef() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.msi b/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.msi deleted file mode 100644 index 0d7e1b21..00000000 Binary files a/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.msi and /dev/null differ diff --git a/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.wxs b/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.wxs deleted file mode 100644 index 8c5027b4..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/PackageSummaryInformation/TypicalV3.wxs +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v3.wxs b/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v3.wxs deleted file mode 100644 index 9a739052..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v3.wxs +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v4_expected.wxs b/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v4_expected.wxs deleted file mode 100644 index 6bf3c1ea..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/PermissionEx/v4_expected.wxs +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs deleted file mode 100644 index 8188d900..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.wxs b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.wxs deleted file mode 100644 index 2eb908c2..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.wxs +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml deleted file mode 100644 index 9d3ad496..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v3.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v3.wxs deleted file mode 100644 index b0fcf9c9..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v3.wxs +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs deleted file mode 100644 index 95d2f618..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Converters/TestData/QtExec/v3.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec/v3.wxs deleted file mode 100644 index 8d81a758..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/QtExec/v3.wxs +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs deleted file mode 100644 index f24d3f8f..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs b/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs deleted file mode 100644 index 5bcdaf59..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs b/src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs deleted file mode 100644 index 310ae811..00000000 --- a/src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs b/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs deleted file mode 100644 index 10450c68..00000000 --- a/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs +++ /dev/null @@ -1,190 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class UtilExtensionFixture : BaseConverterFixture - { - [Fact] - public void FixCloseAppsCondition() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " a<>b", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixXmlConfigValue() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " a<>b", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void WarnsOnAllRegistryValueSearches() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(4, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - - [Fact] - public void FixXmlConfigValueCData() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " b]]>", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixQueryOsPropertyRefs() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(6, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/VariableFixture.cs b/src/test/WixToolsetTest.Converters/VariableFixture.cs deleted file mode 100644 index b7b7388f..00000000 --- a/src/test/WixToolsetTest.Converters/VariableFixture.cs +++ /dev/null @@ -1,86 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class VariableFixture : BaseConverterFixture - { - [Fact] - public void FixFormattedType() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void DoesntFixFormattedTypeFromV4() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(0, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs b/src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs deleted file mode 100644 index 16a68895..00000000 --- a/src/test/WixToolsetTest.Converters/Wix4ConversionFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class Wix4ConversionFixture : BaseConverterFixture - { - [Fact] - public void DoesNotAddFileId() - { - var parse = String.Join(Environment.NewLine, - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(1, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj b/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj deleted file mode 100644 index 29b02b95..00000000 --- a/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - netcoreapp3.1 - false - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3-55-g6feb