From 61d789db5de8613c51df1e7db94f459aadbd3ca8 Mon Sep 17 00:00:00 2001 From: Bevan Weiss Date: Sat, 18 Jan 2025 23:01:30 +1100 Subject: Add a basic unit test for the round msmq decompiler round trip. Needed fix up for Group decompiler to work correctly, adding to Index, and fixing where the Group name column is located. Signed-off-by: Bevan Weiss --- .../WixToolsetTest.Msmq/MsmqExtensionFixture.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/ext/Msmq/test/WixToolsetTest.Msmq/MsmqExtensionFixture.cs') diff --git a/src/ext/Msmq/test/WixToolsetTest.Msmq/MsmqExtensionFixture.cs b/src/ext/Msmq/test/WixToolsetTest.Msmq/MsmqExtensionFixture.cs index 424d3d5b..c89d138a 100644 --- a/src/ext/Msmq/test/WixToolsetTest.Msmq/MsmqExtensionFixture.cs +++ b/src/ext/Msmq/test/WixToolsetTest.Msmq/MsmqExtensionFixture.cs @@ -2,7 +2,10 @@ namespace WixToolsetTest.Msmq { + using System.Data; + using System.IO; using System.Linq; + using System.Xml.Linq; using WixInternal.TestSupport; using WixInternal.Core.TestPackage; using WixToolset.Msmq; @@ -34,6 +37,29 @@ namespace WixToolsetTest.Msmq }, results); } + [Fact] + public void CanRoundtripMessageQueue() + { + var folder = TestData.Get(@"TestData\UsingMessageQueue"); + var build = new Builder(folder, new[] { typeof(MsmqExtensionFactory), typeof(UtilExtensionFactory) }, new[] { folder }); + var output = Path.Combine(folder, "MessageQueueDecompile.xml"); + + build.BuildAndDecompileAndBuild(Build, Decompile, output); + + var doc = XDocument.Load(output); + var actual = doc.Descendants() + .Where(e => e.Name.Namespace == "http://wixtoolset.org/schemas/v4/wxs/msmq") + .Select(fe => new { Name = fe.Name.LocalName, Id = fe.Attributes().Where(a => a.Name == "Id").Select(a => a.Value).FirstOrDefault() }) + .ToArray(); + + WixAssert.CompareLineByLine(new[] + { + "MessageQueue:TestMQ", + "MessageQueuePermission:TestMQ_TestUser", + "MessageQueuePermission:TestMQ_TestGroup", + }, actual.Select(a => $"{a.Name}:{a.Id}").ToArray()); + } + private static void Build(string[] args) { args = args.Concat(new[] { "-arch", "arm64" }).ToArray(); @@ -41,5 +67,11 @@ namespace WixToolsetTest.Msmq var result = WixRunner.Execute(args); result.AssertSuccess(); } + + private static void Decompile(string[] args) + { + var result = WixRunner.Execute(args); + result.AssertSuccess(); + } } } -- cgit v1.2.3-55-g6feb