-
Notifications
You must be signed in to change notification settings - Fork 264
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
12 changed files
with
295 additions
and
13 deletions.
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
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
160 changes: 160 additions & 0 deletions
160
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,160 @@ | ||
// 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 WixToolset.Data.Symbols; | ||
using WixToolset.Data.WindowsInstaller; | ||
using Xunit; | ||
|
||
public class CommentsFixture | ||
{ | ||
[Fact] | ||
public void PackageNoSummaryInformation() | ||
{ | ||
var propertyRows = BuildPackageAndQuerySummaryInformation("PackageNoSummaryInformation.wxs"); | ||
|
||
WixAssert.CompareLineByLine(new[] | ||
{ | ||
"_SummaryInformation:Comments\tThis installer database contains the logic and data required to install MsiPackage." | ||
}, propertyRows); | ||
} | ||
|
||
[Fact] | ||
public void PackageDefaultComments() | ||
{ | ||
var propertyRows = BuildPackageAndQuerySummaryInformation("PackageDefault.wxs"); | ||
|
||
WixAssert.CompareLineByLine(new[] | ||
{ | ||
"_SummaryInformation:Comments\tThis installer database contains the logic and data required to install MsiPackage." | ||
}, propertyRows); | ||
} | ||
|
||
[Fact] | ||
public void PackageEmptyCommentsThrows() | ||
{ | ||
var exception = Assert.Throws<WixException>(() => BuildPackageAndQuerySummaryInformation("PackageEmpty.wxs")); | ||
WixAssert.StringEqual("The SummaryInformation/@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 PackageCustomComments() | ||
{ | ||
var propertyRows = BuildPackageAndQuerySummaryInformation("PackageCustom.wxs"); | ||
|
||
WixAssert.CompareLineByLine(new[] | ||
{ | ||
"_SummaryInformation:Comments\tExample comments" | ||
}, propertyRows); | ||
} | ||
|
||
[Fact] | ||
public void ModuleNoSummaryInformation() | ||
{ | ||
var propertyRows = BuildModuleAndQuerySummaryInformation("ModuleNoSummaryInformation.wxs"); | ||
|
||
WixAssert.CompareLineByLine(new[] | ||
{ | ||
"_SummaryInformation:Comments\tThis merge module contains the logic and data required to install Module." | ||
}, propertyRows); | ||
} | ||
|
||
[Fact] | ||
public void ModuleDefaultComments() | ||
{ | ||
var propertyRows = BuildModuleAndQuerySummaryInformation("ModuleDefault.wxs"); | ||
|
||
WixAssert.CompareLineByLine(new[] | ||
{ | ||
"_SummaryInformation:Comments\tThis merge module contains the logic and data required to install Module." | ||
}, propertyRows); | ||
} | ||
|
||
[Fact] | ||
public void ModuleEmptyCommentsThrows() | ||
{ | ||
var exception = Assert.Throws<WixException>(() => BuildModuleAndQuerySummaryInformation("ModuleEmpty.wxs")); | ||
WixAssert.StringEqual("The SummaryInformation/@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 ModuleCustomComments() | ||
{ | ||
var propertyRows = BuildModuleAndQuerySummaryInformation("ModuleCustom.wxs"); | ||
|
||
WixAssert.CompareLineByLine(new[] | ||
{ | ||
"_SummaryInformation:Comments\tExample comments" | ||
}, propertyRows); | ||
} | ||
|
||
private static string[] BuildPackageAndQuerySummaryInformation(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(); | ||
} | ||
} | ||
|
||
private static string[] BuildModuleAndQuerySummaryInformation(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 msmPath = Path.Combine(binFolder, "test.msm"); | ||
|
||
var result = WixRunner.Execute(new[] | ||
{ | ||
"build", | ||
Path.Combine(folder, file), | ||
"-intermediateFolder", intermediateFolder, | ||
"-bindpath", Path.Combine(folder, "data"), | ||
"-o", msmPath, | ||
}); | ||
|
||
if (result.ExitCode != 0) | ||
{ | ||
throw new WixException(result.Messages.First()); | ||
} | ||
|
||
return Query.QueryDatabase(msmPath, new[] { "Property", "_SummaryInformation" }) | ||
.Where(s => s.StartsWith("_SummaryInformation:Comments")) | ||
.OrderBy(s => s) | ||
.ToArray(); | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleCustom.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,16 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
<Module | ||
Id="Module" | ||
Language="1033" | ||
Version="1.0.0.0" | ||
Guid="243FB739-4D05-472F-9CFB-EF6B1017B6DE"> | ||
<SummaryInformation Comments="Example comments" /> | ||
|
||
<Directory Id="ModuleFolder"> | ||
<Component Id="ModuleComponent" Guid="A04E61B2-3ED4-4803-B2EB-4B773576FA45"> | ||
<File Id="File1" Name="file.txt" Source="test.txt" /> | ||
</Component> | ||
</Directory> | ||
|
||
</Module> | ||
</Wix> |
16 changes: 16 additions & 0 deletions
16
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleDefault.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,16 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
<Module | ||
Id="Module" | ||
Language="1033" | ||
Version="1.0.0.0" | ||
Guid="243FB739-4D05-472F-9CFB-EF6B1017B6DE"> | ||
<SummaryInformation /> | ||
|
||
<Directory Id="ModuleFolder"> | ||
<Component Id="ModuleComponent" Guid="A04E61B2-3ED4-4803-B2EB-4B773576FA45"> | ||
<File Id="File1" Name="file.txt" Source="test.txt" /> | ||
</Component> | ||
</Directory> | ||
|
||
</Module> | ||
</Wix> |
16 changes: 16 additions & 0 deletions
16
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleEmpty.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,16 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
<Module | ||
Id="Module" | ||
Language="1033" | ||
Version="1.0.0.0" | ||
Guid="243FB739-4D05-472F-9CFB-EF6B1017B6DE"> | ||
<SummaryInformation Comments="" /> | ||
|
||
<Directory Id="ModuleFolder"> | ||
<Component Id="ModuleComponent" Guid="A04E61B2-3ED4-4803-B2EB-4B773576FA45"> | ||
<File Id="File1" Name="file.txt" Source="test.txt" /> | ||
</Component> | ||
</Directory> | ||
|
||
</Module> | ||
</Wix> |
15 changes: 15 additions & 0 deletions
15
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/ModuleNoSummaryInformation.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,15 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
<Module | ||
Id="Module" | ||
Language="1033" | ||
Version="1.0.0.0" | ||
Guid="243FB739-4D05-472F-9CFB-EF6B1017B6DE"> | ||
|
||
<Directory Id="ModuleFolder"> | ||
<Component Id="ModuleComponent" Guid="A04E61B2-3ED4-4803-B2EB-4B773576FA45"> | ||
<File Id="File1" Name="file.txt" Source="test.txt" /> | ||
</Component> | ||
</Directory> | ||
|
||
</Module> | ||
</Wix> |
9 changes: 9 additions & 0 deletions
9
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageCustom.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"> | ||
<MajorUpgrade DowngradeErrorMessage="Downgrade not allowed" /> | ||
<SummaryInformation Comments="Example comments" /> | ||
</Package> | ||
</Wix> |
9 changes: 9 additions & 0 deletions
9
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageDefault.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"> | ||
<MajorUpgrade DowngradeErrorMessage="Downgrade not allowed" /> | ||
<SummaryInformation /> | ||
</Package> | ||
</Wix> |
9 changes: 9 additions & 0 deletions
9
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageEmpty.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"> | ||
<MajorUpgrade DowngradeErrorMessage="Downgrade not allowed" /> | ||
<SummaryInformation Comments="" /> | ||
</Package> | ||
</Wix> |
8 changes: 8 additions & 0 deletions
8
...wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/PackageNoSummaryInformation.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> |
1 change: 1 addition & 0 deletions
1
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Comments/data/test.txt
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 @@ | ||
This is test.txt. |