-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #7369
- Loading branch information
Showing
5 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/wix/test/WixToolsetTest.CoreIntegration/CommentsFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// 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.CoreIntegration | ||
{ | ||
using System.IO; | ||
using System.Linq; | ||
using WixInternal.Core.TestPackage; | ||
using WixInternal.TestSupport; | ||
using WixToolset.Data; | ||
using Xunit; | ||
|
||
public class CommentsFixture | ||
{ | ||
[Fact] | ||
public void DefaultComments() | ||
{ | ||
var propertyRows = BuildAndQuerySummaryInformation("Default.wxs"); | ||
|
||
WixAssert.CompareLineByLine(new[] | ||
{ | ||
"_SummaryInformation:Comments\tThis installer database contains the logic and data required to install MsiPackage." | ||
}, propertyRows); | ||
} | ||
|
||
[Fact] | ||
public void EmptyCommentsThrows() | ||
{ | ||
var exception = Assert.Throws<WixException>(() => BuildAndQuerySummaryInformation("Empty.wxs")); | ||
WixAssert.StringEqual("The Package/@Comments attribute's value cannot be an empty string. If a value is not required, simply remove the entire attribute.", exception.Message); | ||
} | ||
|
||
[Fact] | ||
public void CustomComments() | ||
{ | ||
var propertyRows = BuildAndQuerySummaryInformation("Custom.wxs"); | ||
|
||
WixAssert.CompareLineByLine(new[] | ||
{ | ||
"_SummaryInformation:Comments\tExample comments" | ||
}, propertyRows); | ||
} | ||
|
||
private static string[] BuildAndQuerySummaryInformation(string file) | ||
{ | ||
var folder = TestData.Get("TestData", "Comments"); | ||
|
||
using (var fs = new DisposableFileSystem()) | ||
{ | ||
var baseFolder = fs.GetFolder(); | ||
var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
var binFolder = Path.Combine(baseFolder, "bin"); | ||
var msiPath = Path.Combine(binFolder, "test.msi"); | ||
|
||
var result = WixRunner.Execute(new[] | ||
{ | ||
"build", | ||
Path.Combine(folder, file), | ||
"-intermediateFolder", intermediateFolder, | ||
"-bindpath", folder, | ||
"-o", msiPath, | ||
}); | ||
|
||
if(result.ExitCode != 0) | ||
{ | ||
throw new WixException(result.Messages.First()); | ||
} | ||
|
||
return Query.QueryDatabase(msiPath, new[] { "Property", "_SummaryInformation" }) | ||
.Where(s => s.StartsWith("_SummaryInformation:Comments")) | ||
.OrderBy(s => s) | ||
.ToArray(); | ||
} | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/Custom.wxs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
<Package Version="1" | ||
Name="MsiPackage" | ||
Manufacturer="Example Corporation" | ||
UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" | ||
Comments="Example comments"> | ||
<MajorUpgrade DowngradeErrorMessage="Downgrade not allowed" /> | ||
</Package> | ||
</Wix> |
8 changes: 8 additions & 0 deletions
8
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/Default.wxs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
<Package Version="1" | ||
Name="MsiPackage" | ||
Manufacturer="Example Corporation" | ||
UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
<MajorUpgrade DowngradeErrorMessage="Downgrade not allowed" /> | ||
</Package> | ||
</Wix> |
9 changes: 9 additions & 0 deletions
9
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/Empty.wxs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
<Package Version="1" | ||
Name="MsiPackage" | ||
Manufacturer="Example Corporation" | ||
UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" | ||
Comments=""> | ||
<MajorUpgrade DowngradeErrorMessage="Downgrade not allowed" /> | ||
</Package> | ||
</Wix> |