From f0544d8b04951ea0c9ccd03bcdd8284a96bc569c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 26 Jun 2020 14:04:15 -0700 Subject: Ensure Include elements have correct namespace Fixes wixtoolset/issues#5891 --- .../WixToolsetTest.Converters/IncludeFixture.cs | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/test/WixToolsetTest.Converters/IncludeFixture.cs (limited to 'src') diff --git a/src/test/WixToolsetTest.Converters/IncludeFixture.cs b/src/test/WixToolsetTest.Converters/IncludeFixture.cs new file mode 100644 index 00000000..7be2c030 --- /dev/null +++ b/src/test/WixToolsetTest.Converters/IncludeFixture.cs @@ -0,0 +1,67 @@ +// 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 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); + 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); + CompareLineByLine(expected, actualLines); + } + } +} -- cgit v1.2.3-55-g6feb