Skip to content

Commit 07e7bd9

Browse files
committed
Additional fixes for some xunit Assert statements.
Set WixInternal.Core.TestPackage as only netstandard2.0 library. Set Wixinternal.TestSupport as netstandard2.0 and net472. System.Memory pinned to 4.5.5 to have consistent binding as transitive. Signed-off-by: Bevan Weiss <[email protected]>
1 parent c5832b0 commit 07e7bd9

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void CanBuildUsingWixUIFeatureTree()
125125
{
126126
"CustomAction:SetWIXUI_EXITDIALOGOPTIONALTEXT\t51\tWIXUI_EXITDIALOGOPTIONALTEXT\tThank you for installing [ProductName].\t",
127127
}, results.Where(r => r.StartsWith("CustomAction:")).ToArray());
128-
Assert.Empty(results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")));
128+
Assert.DoesNotContain(results, result => result.StartsWith("ControlEvent:") && result.Contains("DoAction"));
129129
WixAssert.CompareLineByLine(new[]
130130
{
131131
"InstallUISequence:WelcomeDlg\tNOT Installed OR PATCH\t1297",
@@ -189,8 +189,8 @@ public void CanBuildUsingWixUIMinimal()
189189
"Binary:WixUI_Ico_Exclam\t[Binary data]",
190190
"Binary:WixUI_Ico_Info\t[Binary data]",
191191
}, results.Where(r => r.StartsWith("Binary:")).ToArray());
192-
Assert.Empty(results.Where(r => r.StartsWith("CustomAction:")));
193-
Assert.Empty(results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")));
192+
Assert.DoesNotContain(results, r => r.StartsWith("CustomAction:"));
193+
Assert.DoesNotContain(results, result => result.StartsWith("ControlEvent:") && result.Contains("DoAction"));
194194
WixAssert.CompareLineByLine(new[]
195195
{
196196
"InstallUISequence:WelcomeDlg\tInstalled AND PATCH\t1296",
@@ -357,7 +357,7 @@ public void CanBuildWithInstallDirAndAddedDialog()
357357

358358
Assert.Equal(10, results.Where(result => result.StartsWith("Control:") && result.Contains("SpecialDlg")).Count());
359359
Assert.Equal(5, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("SpecialDlg")).Count());
360-
Assert.Single(results.Where(result => result.StartsWith("Dialog:") && result.Contains("SpecialDlg")));
360+
Assert.Single(results, result => result.StartsWith("Dialog:") && result.Contains("SpecialDlg"));
361361
}
362362

363363
[Fact]

src/internal/SetBuildNumber/Directory.Packages.props.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<PackageVersion Include="System.Security.Principal.Windows" Version="5.0.0" />
6565
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" />
6666
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
67+
<PackageVersion Include="System.Memory" Version="4.5.5" />
6768

6869
<PackageVersion Include="Microsoft.AspNetCore.Owin" Version="8.0.12" />
6970
<PackageVersion Include="Microsoft.VisualStudio.Setup.Configuration.Native" Version="3.11.2177" />

src/internal/WixInternal.TestSupport/TestData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ public static void CreateFile(string path, long size, bool fill = false)
4444

4545
public static string Get(params string[] paths)
4646
{
47-
var localPath = AppDomain.CurrentDomain.BaseDirectory;
47+
var localPath = Path.GetDirectoryName(new Uri(Assembly.GetCallingAssembly().CodeBase).LocalPath);
4848
return Path.Combine(localPath, Path.Combine(paths));
4949
}
5050

5151
public static string GetUnitTestLogsFolder([CallerFilePath] string path = "", [CallerMemberName] string method = "")
5252
{
53-
var startingPath = AppDomain.CurrentDomain.BaseDirectory;
53+
var startingPath = Path.GetDirectoryName(new Uri(Assembly.GetCallingAssembly().CodeBase).LocalPath);
5454
var buildPath = startingPath;
5555

5656
while (!String.IsNullOrEmpty(buildPath))

src/wix/WixInternal.Core.TestPackage/WixInternal.Core.TestPackage.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<Project Sdk="Microsoft.NET.Sdk">
55
<PropertyGroup>
6-
<TargetFrameworks>net6.0;net472</TargetFrameworks>
6+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
77
<Description>Internal WiX Toolset Test Package</Description>
88
<DebugType>embedded</DebugType>
99
<PublishRepositoryUrl>true</PublishRepositoryUrl>

src/wix/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void DetectUnconvertableQtExecCmdTimeout()
162162
var result = RunConversion(targetFile);
163163

164164
Assert.Equal(13, result.ExitCode);
165-
Assert.Single(result.Messages.Where(message => message.ToString().EndsWith("(QtExecCmdTimeoutAmbiguous)")));
165+
Assert.Single(result.Messages, message => message.ToString().EndsWith("(QtExecCmdTimeoutAmbiguous)"));
166166

167167
var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
168168
var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");

src/wix/test/WixToolsetTest.Converters/UIExtensionFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void FixValidatePathCustomAction()
126126
var actual = UnformattedDocumentLines(document);
127127

128128
WixAssert.CompareLineByLine(expected, actual);
129-
Assert.Single(messaging.Messages.Where(m => m.Id == 65));
129+
Assert.Single(messaging.Messages, m => m.Id == 65);
130130
Assert.Equal(2, errors);
131131
}
132132
}

src/wix/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ public void CanBuildWixlibWithBinariesFromNamedBindPaths()
125125
var wixlib = Intermediate.Load(wixlibPath);
126126
var binarySymbols = wixlib.Sections.SelectMany(s => s.Symbols).OfType<BinarySymbol>().ToList();
127127
Assert.Equal(3, binarySymbols.Count);
128-
Assert.Single(binarySymbols.Where(t => t.Data.Path == "wix-ir/foo.dll"));
129-
Assert.Single(binarySymbols.Where(t => t.Data.Path == "wix-ir/foo.dll-1"));
130-
Assert.Single(binarySymbols.Where(t => t.Data.Path == "wix-ir/foo.dll-2"));
128+
Assert.Single(binarySymbols, t => t.Data.Path == "wix-ir/foo.dll");
129+
Assert.Single(binarySymbols, t => t.Data.Path == "wix-ir/foo.dll-1");
130+
Assert.Single(binarySymbols, t => t.Data.Path == "wix-ir/foo.dll-2");
131131
}
132132
}
133133

0 commit comments

Comments
 (0)