diff options
| -rw-r--r-- | src/wix/WixToolset.Converters/WixConverter.cs | 20 | ||||
| -rw-r--r-- | src/wix/test/WixToolsetTest.Converters/RelatedBundleFixture.cs | 61 |
2 files changed, 81 insertions, 0 deletions
diff --git a/src/wix/WixToolset.Converters/WixConverter.cs b/src/wix/WixToolset.Converters/WixConverter.cs index 2f00d15d..3b8966cb 100644 --- a/src/wix/WixToolset.Converters/WixConverter.cs +++ b/src/wix/WixToolset.Converters/WixConverter.cs | |||
| @@ -115,6 +115,7 @@ namespace WixToolset.Converters | |||
| 115 | private static readonly XName RequiresElementName = WixNamespace + "Requires"; | 115 | private static readonly XName RequiresElementName = WixNamespace + "Requires"; |
| 116 | private static readonly XName RequiresRefElementName = WixNamespace + "RequiresRef"; | 116 | private static readonly XName RequiresRefElementName = WixNamespace + "RequiresRef"; |
| 117 | private static readonly XName MultiStringValueElementName = WixNamespace + "MultiStringValue"; | 117 | private static readonly XName MultiStringValueElementName = WixNamespace + "MultiStringValue"; |
| 118 | private static readonly XName RelatedBundleElementName = WixNamespace + "RelatedBundle"; | ||
| 118 | private static readonly XName RemotePayloadElementName = WixNamespace + "RemotePayload"; | 119 | private static readonly XName RemotePayloadElementName = WixNamespace + "RemotePayload"; |
| 119 | private static readonly XName RegistryKeyElementName = WixNamespace + "RegistryKey"; | 120 | private static readonly XName RegistryKeyElementName = WixNamespace + "RegistryKey"; |
| 120 | private static readonly XName RegistrySearchElementName = WixNamespace + "RegistrySearch"; | 121 | private static readonly XName RegistrySearchElementName = WixNamespace + "RegistrySearch"; |
| @@ -313,6 +314,7 @@ namespace WixToolset.Converters | |||
| 313 | { WixConverter.MultiStringValueElementName, this.ConvertMultiStringValueElement }, | 314 | { WixConverter.MultiStringValueElementName, this.ConvertMultiStringValueElement }, |
| 314 | { WixConverter.RegistryKeyElementName, this.ConvertRegistryKeyElement }, | 315 | { WixConverter.RegistryKeyElementName, this.ConvertRegistryKeyElement }, |
| 315 | { WixConverter.RegistrySearchElementName, this.ConvertRegistrySearchElement }, | 316 | { WixConverter.RegistrySearchElementName, this.ConvertRegistrySearchElement }, |
| 317 | { WixConverter.RelatedBundleElementName, this.ConvertRelatedBundleElement }, | ||
| 316 | { WixConverter.RemotePayloadElementName, this.ConvertRemotePayloadElement }, | 318 | { WixConverter.RemotePayloadElementName, this.ConvertRemotePayloadElement }, |
| 317 | { WixConverter.RequiredPrivilegeElementName, this.ConvertRequiredPrivilegeElement }, | 319 | { WixConverter.RequiredPrivilegeElementName, this.ConvertRequiredPrivilegeElement }, |
| 318 | { WixConverter.CustomActionRefElementName, this.ConvertCustomActionRefElement }, | 320 | { WixConverter.CustomActionRefElementName, this.ConvertCustomActionRefElement }, |
| @@ -1713,6 +1715,19 @@ namespace WixToolset.Converters | |||
| 1713 | } | 1715 | } |
| 1714 | } | 1716 | } |
| 1715 | 1717 | ||
| 1718 | private void ConvertRelatedBundleElement(XElement element) | ||
| 1719 | { | ||
| 1720 | var xAction = element.Attribute("Action"); | ||
| 1721 | var value = xAction?.Value; | ||
| 1722 | var lowercaseValue = value?.ToLowerInvariant(); | ||
| 1723 | |||
| 1724 | if (value != lowercaseValue | ||
| 1725 | && this.OnInformation(ConverterTestType.RelatedBundleActionLowercase, element, "The RelatedBundle element's Action attribute value must now be all lowercase. The Action='{0}' will be converted to '{1}'", value, lowercaseValue)) | ||
| 1726 | { | ||
| 1727 | xAction.Value = lowercaseValue; | ||
| 1728 | } | ||
| 1729 | } | ||
| 1730 | |||
| 1716 | private void ConvertRemotePayloadElement(XElement element) | 1731 | private void ConvertRemotePayloadElement(XElement element) |
| 1717 | { | 1732 | { |
| 1718 | var xParent = element.Parent; | 1733 | var xParent = element.Parent; |
| @@ -3303,6 +3318,11 @@ namespace WixToolset.Converters | |||
| 3303 | /// The Certificate BinaryKey element has been renamed to BinaryRef. | 3318 | /// The Certificate BinaryKey element has been renamed to BinaryRef. |
| 3304 | /// </summary> | 3319 | /// </summary> |
| 3305 | CertificateBinaryKeyIsNowBinaryRef, | 3320 | CertificateBinaryKeyIsNowBinaryRef, |
| 3321 | |||
| 3322 | /// <summary> | ||
| 3323 | /// The RelatedBundle element's Action attribute value must now be all lowercase. The Action='{0}' will be converted to '{1}' | ||
| 3324 | /// </summary> | ||
| 3325 | RelatedBundleActionLowercase, | ||
| 3306 | } | 3326 | } |
| 3307 | } | 3327 | } |
| 3308 | } | 3328 | } |
diff --git a/src/wix/test/WixToolsetTest.Converters/RelatedBundleFixture.cs b/src/wix/test/WixToolsetTest.Converters/RelatedBundleFixture.cs new file mode 100644 index 00000000..ea0be80b --- /dev/null +++ b/src/wix/test/WixToolsetTest.Converters/RelatedBundleFixture.cs | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolsetTest.Converters | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Linq; | ||
| 7 | using System.Xml.Linq; | ||
| 8 | using WixInternal.TestSupport; | ||
| 9 | using WixToolset.Converters; | ||
| 10 | using WixToolsetTest.Converters.Mocks; | ||
| 11 | using Xunit; | ||
| 12 | |||
| 13 | public class RelatedBundleFixture : BaseConverterFixture | ||
| 14 | { | ||
| 15 | [Fact] | ||
| 16 | public void CanConvertActionToLowercase() | ||
| 17 | { | ||
| 18 | var parse = String.Join(Environment.NewLine, | ||
| 19 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
| 20 | " <Fragment>", | ||
| 21 | " <RelatedBundle Id='D' Action='Detect' />", | ||
| 22 | " <RelatedBundle Id='U' Action='Upgrade' />", | ||
| 23 | " <RelatedBundle Id='A' Action='Addon' />", | ||
| 24 | " <RelatedBundle Id='P' Action='Patch' />", | ||
| 25 | " </Fragment>", | ||
| 26 | "</Wix>"); | ||
| 27 | |||
| 28 | var expected = new[] | ||
| 29 | { | ||
| 30 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 31 | " <Fragment>", | ||
| 32 | " <RelatedBundle Id=\"D\" Action=\"detect\" />", | ||
| 33 | " <RelatedBundle Id=\"U\" Action=\"upgrade\" />", | ||
| 34 | " <RelatedBundle Id=\"A\" Action=\"addon\" />", | ||
| 35 | " <RelatedBundle Id=\"P\" Action=\"patch\" />", | ||
| 36 | " </Fragment>", | ||
| 37 | "</Wix>" | ||
| 38 | }; | ||
| 39 | |||
| 40 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 41 | |||
| 42 | var messaging = new MockMessaging(); | ||
| 43 | var converter = new WixConverter(messaging, 2, null, null); | ||
| 44 | |||
| 45 | var errors = converter.ConvertDocument(document); | ||
| 46 | |||
| 47 | var actualLines = UnformattedDocumentLines(document); | ||
| 48 | WixAssert.CompareLineByLine(expected, actualLines); | ||
| 49 | |||
| 50 | WixAssert.CompareLineByLine(new[] | ||
| 51 | { | ||
| 52 | "[Converted] The RelatedBundle element's Action attribute value must now be all lowercase. The Action='Detect' will be converted to 'detect' (RelatedBundleActionLowercase)", | ||
| 53 | "[Converted] The RelatedBundle element's Action attribute value must now be all lowercase. The Action='Upgrade' will be converted to 'upgrade' (RelatedBundleActionLowercase)", | ||
| 54 | "[Converted] The RelatedBundle element's Action attribute value must now be all lowercase. The Action='Addon' will be converted to 'addon' (RelatedBundleActionLowercase)", | ||
| 55 | "[Converted] The RelatedBundle element's Action attribute value must now be all lowercase. The Action='Patch' will be converted to 'patch' (RelatedBundleActionLowercase)", | ||
| 56 | }, messaging.Messages.Select(m => m.ToString()).ToArray()); | ||
| 57 | |||
| 58 | Assert.Equal(4, errors); | ||
| 59 | } | ||
| 60 | } | ||
| 61 | } | ||
