diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.Converters/Wix3Converter.cs | 6 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Converters/ConverterFixture.cs | 31 |
2 files changed, 34 insertions, 3 deletions
diff --git a/src/WixToolset.Converters/Wix3Converter.cs b/src/WixToolset.Converters/Wix3Converter.cs index c23930b6..9fde7360 100644 --- a/src/WixToolset.Converters/Wix3Converter.cs +++ b/src/WixToolset.Converters/Wix3Converter.cs | |||
| @@ -35,6 +35,7 @@ namespace WixToolset.Converters | |||
| 35 | private static readonly XName CustomActionElementName = WixNamespace + "CustomAction"; | 35 | private static readonly XName CustomActionElementName = WixNamespace + "CustomAction"; |
| 36 | private static readonly XName PropertyElementName = WixNamespace + "Property"; | 36 | private static readonly XName PropertyElementName = WixNamespace + "Property"; |
| 37 | private static readonly XName WixElementWithoutNamespaceName = XNamespace.None + "Wix"; | 37 | private static readonly XName WixElementWithoutNamespaceName = XNamespace.None + "Wix"; |
| 38 | private static readonly XName IncludeElementWithoutNamespaceName = XNamespace.None + "Include"; | ||
| 38 | 39 | ||
| 39 | private static readonly Dictionary<string, XNamespace> OldToNewNamespaceMapping = new Dictionary<string, XNamespace>() | 40 | private static readonly Dictionary<string, XNamespace> OldToNewNamespaceMapping = new Dictionary<string, XNamespace>() |
| 40 | { | 41 | { |
| @@ -86,7 +87,8 @@ namespace WixToolset.Converters | |||
| 86 | { Wix3Converter.PayloadElementName, this.ConvertSuppressSignatureValidation }, | 87 | { Wix3Converter.PayloadElementName, this.ConvertSuppressSignatureValidation }, |
| 87 | { Wix3Converter.CustomActionElementName, this.ConvertCustomActionElement }, | 88 | { Wix3Converter.CustomActionElementName, this.ConvertCustomActionElement }, |
| 88 | { Wix3Converter.PropertyElementName, this.ConvertPropertyElement }, | 89 | { Wix3Converter.PropertyElementName, this.ConvertPropertyElement }, |
| 89 | { Wix3Converter.WixElementWithoutNamespaceName, this.ConvertWixElementWithoutNamespace }, | 90 | { Wix3Converter.WixElementWithoutNamespaceName, this.ConvertElementWithoutNamespace }, |
| 91 | { Wix3Converter.IncludeElementWithoutNamespaceName, this.ConvertElementWithoutNamespace }, | ||
| 90 | }; | 92 | }; |
| 91 | 93 | ||
| 92 | this.Messaging = messaging; | 94 | this.Messaging = messaging; |
| @@ -399,7 +401,7 @@ namespace WixToolset.Converters | |||
| 399 | /// </summary> | 401 | /// </summary> |
| 400 | /// <param name="element">The Wix element to convert.</param> | 402 | /// <param name="element">The Wix element to convert.</param> |
| 401 | /// <returns>The converted element.</returns> | 403 | /// <returns>The converted element.</returns> |
| 402 | private void ConvertWixElementWithoutNamespace(XElement element) | 404 | private void ConvertElementWithoutNamespace(XElement element) |
| 403 | { | 405 | { |
| 404 | if (this.OnError(ConverterTestType.XmlnsMissing, element, "The xmlns attribute is missing. It must be present with a value of '{0}'.", WixNamespace.NamespaceName)) | 406 | if (this.OnError(ConverterTestType.XmlnsMissing, element, "The xmlns attribute is missing. It must be present with a value of '{0}'.", WixNamespace.NamespaceName)) |
| 405 | { | 407 | { |
diff --git a/src/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/test/WixToolsetTest.Converters/ConverterFixture.cs index 97769cd6..71069333 100644 --- a/src/test/WixToolsetTest.Converters/ConverterFixture.cs +++ b/src/test/WixToolsetTest.Converters/ConverterFixture.cs | |||
| @@ -364,7 +364,7 @@ namespace WixToolsetTest.Converters | |||
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | [Fact] | 366 | [Fact] |
| 367 | public void CanConvertMissingNamespace() | 367 | public void CanConvertMissingWixNamespace() |
| 368 | { | 368 | { |
| 369 | var parse = String.Join(Environment.NewLine, | 369 | var parse = String.Join(Environment.NewLine, |
| 370 | "<?xml version='1.0' encoding='utf-8'?>", | 370 | "<?xml version='1.0' encoding='utf-8'?>", |
| @@ -393,6 +393,35 @@ namespace WixToolsetTest.Converters | |||
| 393 | } | 393 | } |
| 394 | 394 | ||
| 395 | [Fact] | 395 | [Fact] |
| 396 | public void CanConvertMissingIncludeNamespace() | ||
| 397 | { | ||
| 398 | var parse = String.Join(Environment.NewLine, | ||
| 399 | "<?xml version='1.0' encoding='utf-8'?>", | ||
| 400 | "<Include>", | ||
| 401 | " <?define Version = 1.2.3 ?>", | ||
| 402 | "</Include>"); | ||
| 403 | |||
| 404 | var expected = String.Join(Environment.NewLine, | ||
| 405 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", | ||
| 406 | "<Include xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 407 | " <?define Version = 1.2.3 ?>", | ||
| 408 | "</Include>"); | ||
| 409 | |||
| 410 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 411 | |||
| 412 | var messaging = new DummyMessaging(); | ||
| 413 | var converter = new Wix3Converter(messaging, 2, null, null); | ||
| 414 | |||
| 415 | var errors = converter.ConvertDocument(document); | ||
| 416 | |||
| 417 | var actual = UnformattedDocumentString(document); | ||
| 418 | |||
| 419 | Assert.Equal(1, errors); | ||
| 420 | Assert.Equal(expected, actual); | ||
| 421 | Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace()); | ||
| 422 | } | ||
| 423 | |||
| 424 | [Fact] | ||
| 396 | public void CanConvertAnonymousFile() | 425 | public void CanConvertAnonymousFile() |
| 397 | { | 426 | { |
| 398 | var parse = String.Join(Environment.NewLine, | 427 | var parse = String.Join(Environment.NewLine, |
