Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Upgrade to xUnit v3
- Set TestRunnerName=XUnitV3 to use Arcade's xUnit v3 support
- Add OutputType=Exe required by xUnit v3
- Replace Skip.If/IfNot with Assert.SkipWhen/SkipUnless (v3 API)
- Remove Xunit.Abstractions using (ITestOutputHelper moved to Xunit namespace)
- Add Verify.XunitV3 package for snapshot testing compatibility

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
MichaelSimons and Copilot committed Apr 29, 2026
commit e7e5fdaca1135f293bbf7f5040a16579a8e22867
8 changes: 4 additions & 4 deletions tests/Install-Scripts.Test/AkaMsLinksTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void SDK_IntegrationTest(string channel, string quality, string expectedL
[InlineData("7.0", "windowsdesktop", "daily", @"https://aka.ms/dotnet/7.0/daily/windowsdesktop-runtime-")]
public void Runtime_IntegrationTest(string channel, string runtime, string quality, string expectedLink)
{
Skip.If(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && runtime == "windowsdesktop",
Assert.SkipWhen(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && runtime == "windowsdesktop",
"Do not run windowsdesktop tests on non-Windows environment.");

string expectedLinkPattern = Regex.Escape(expectedLink);
Expand Down Expand Up @@ -243,7 +243,7 @@ public void LinkCanBeCreatedForSdk(string channel, string? quality, bool isInter
[InlineData("9.0", "windowsdesktop", "ga", true, @"https://aka.ms/dotnet/internal/9.0/windowsdesktop-runtime-")]
public void LinkCanBeCreatedForGivenRuntime(string channel, string runtime, string? quality, bool isInternal, string expectedLink)
{
Skip.If(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && runtime == "windowsdesktop",
Assert.SkipWhen(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && runtime == "windowsdesktop",
"Do not run windowsdesktop tests on non-Windows environment.");

string expectedLinkPattern = Regex.Escape(expectedLink);
Expand Down Expand Up @@ -292,7 +292,7 @@ public void LinkCanBeCreatedForGivenRuntime(string channel, string runtime, stri
[InlineData("LTS", "windowsdesktop", "preview", @"https://aka.ms/dotnet/LTS/windowsdesktop-runtime-")]
public void QualityIsSkippedForLTSAndCurrentChannel(string channel, string? runtime, string quality, string expectedLink)
{
Skip.If(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && runtime == "windowsdesktop",
Assert.SkipWhen(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && runtime == "windowsdesktop",
"Do not run windowsdesktop tests on non-Windows environment.");

string expectedLinkPattern = Regex.Escape(expectedLink);
Expand Down Expand Up @@ -328,7 +328,7 @@ public void QualityIsSkippedForLTSAndCurrentChannel(string channel, string? runt
[InlineData("Fake", "windowsdesktop", "daily")]
public void NoFallbackIfQualityIsGiven(string channel, string? runtime, string quality)
{
Skip.If(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && runtime == "windowsdesktop",
Assert.SkipWhen(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && runtime == "windowsdesktop",
"Do not run windowsdesktop tests on non-Windows environment.");

var args = new List<string> { "-dryrun", "-channel", channel, "-verbose", "-quality", quality };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void WhenRuntimeParametersArePassedToInstallScripts(string runtime, strin
[InlineData("master", "windowsdesktop", true)]
public void WhenChannelResolvesToASpecificRuntimeVersion(string channel, string runtimeType, bool useCustomFeedCredential = false)
{
Skip.If(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && runtimeType == "windowsdesktop",
Assert.SkipWhen(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && runtimeType == "windowsdesktop",
"Do not run windowsdesktop tests on non-Windows environment.");
Comment thread
MichaelSimons marked this conversation as resolved.

var args = new List<string> { "-dryrun", "-channel", channel, "-runtime", runtimeType };
Expand Down Expand Up @@ -287,7 +287,7 @@ public void WhenChannelResolvesToASpecificSDKVersion(string channel, bool useFee
[InlineData("3.1.10", "Runtime")]
public void CanResolveCorrectLocationBasedOnVersion(string version, string location)
{
Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
Assert.SkipUnless(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
"Do not run windowsdesktop tests on non-Windows environment.");
Comment thread
MichaelSimons marked this conversation as resolved.

string expectedLinkLog = $"Constructed primary named payload URL: {Environment.NewLine}https://builds.dotnet.microsoft.com/dotnet/{location}/{version}";
Expand Down Expand Up @@ -351,7 +351,7 @@ public void WhenInstallDirAliasIsUsed()
[InlineData("10.0.100", null)]
public async Task WhenAnExactVersionIsPassedToBash(string version, string? runtime)
{
Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
Assert.SkipWhen(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
"Do not run bash tests on Windows environment.");
Comment thread
MichaelSimons marked this conversation as resolved.

string[] args;
Expand Down Expand Up @@ -386,7 +386,7 @@ public async Task WhenAnExactVersionIsPassedToBash(string version, string? runti
[Fact]
public async Task WhenMacosIsPassedToBash()
{
Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
Assert.SkipWhen(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
"Do not run bash tests on Windows environment.");
Comment thread
MichaelSimons marked this conversation as resolved.

string[] args = new string[] {
Expand Down Expand Up @@ -420,7 +420,7 @@ await Verify(commandResult.StdOut)
[InlineData("10.0.100", null)]
public async Task WhenAnExactVersionIsPassedToPowershell(string version, string? runtime)
{
Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
Assert.SkipUnless(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
"Do not run PowerShell tests on non-Windows environment.");
Comment thread
MichaelSimons marked this conversation as resolved.

string[] args;
Expand Down Expand Up @@ -451,7 +451,7 @@ public async Task WhenAnExactVersionIsPassedToPowershell(string version, string?
[Fact]
public void ShowScriptPurposeBlurbBash()
{
Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
Assert.SkipWhen(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
"Do not run bash tests on Windows environment.");

const string IntroBlurb = @"
Expand All @@ -478,7 +478,7 @@ .NET Tools Installer
[Fact]
public void ShowScriptPurposeBlurbBashPowershellVerbose()
{
Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
Assert.SkipUnless(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
"Do not run PowerShell tests on non-Windows environment.");


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.Text;
using System.Text.RegularExpressions;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.DotNet.InstallationScript.Tests
{
Expand Down Expand Up @@ -270,7 +269,7 @@ public void WhenInstallingDotnetRuntime(string channel, string? quality, string
[MemberData(nameof(InstallRuntimeFromChannelTestCases))]
public void WhenInstallingAspNetCoreRuntime(string channel, string? quality, string versionRegex)
{
Skip.If(channel == "release/3.0" || channel == "release/3.1",
Assert.SkipWhen(channel == "release/3.0" || channel == "release/3.1",
"These scenarios are broken for release/3.0 and release/3.1.");

// Run install script to download and install.
Expand Down Expand Up @@ -300,7 +299,7 @@ public void WhenInstallingAspNetCoreRuntime(string channel, string? quality, str
public void WhenInstallingWindowsdesktopRuntime(string channel, string? quality, string versionRegex)
#pragma warning restore xUnit1026
{
Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
Assert.SkipUnless(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
"Don't install windowsdesktop if not on Windows.");

List<Regex> exclusions = new List<Regex>()
Expand All @@ -312,7 +311,7 @@ public void WhenInstallingWindowsdesktopRuntime(string channel, string? quality,
new Regex("6.0-preview2"), // Broken scenario.
};

Skip.If(exclusions.Any(e => e.IsMatch(channel)), "Test is excluded for this channel.");
Assert.SkipWhen(exclusions.Any(e => e.IsMatch(channel)), "Test is excluded for this channel.");

// Run install script to download and install.
var args = GetInstallScriptArgs(channel, "windowsdesktop", quality, _sdkInstallationDirectory);
Expand Down Expand Up @@ -471,7 +470,7 @@ public void WhenInstallingASpecificVersionOfAspNetCoreRuntime(string version, st
[InlineData("11.0.0-preview.1.26104.118")]
public void WhenInstallingASpecificVersionOfWindowsdesktopRuntime(string version)
{
Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
Assert.SkipUnless(RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
"Don't install windowsdesktop if not on Windows.");

// Run install script to download and install.
Expand Down Expand Up @@ -504,7 +503,7 @@ public void WhenInstallingASpecificVersionOfWindowsdesktopRuntime(string version
[InlineData("7.0.0-alpha.1.21472.1", null, "windowsdesktop")]
public void WhenInstallingAnAlreadyInstalledVersion(string version, string? effectiveVersion = null, string? runtime = null)
{
Skip.If(runtime == "windowsdesktop" && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
Assert.SkipWhen(runtime == "windowsdesktop" && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows),
"Don't install windowsdesktop if not on Windows.");

// Run install script to download and install.
Expand Down
1 change: 1 addition & 0 deletions tests/Install-Scripts.Test/Install-Scripts.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<OutputType>Exe</OutputType>
<RootNamespace>Install_Scripts.Test</RootNamespace>
<IsPackable>false</IsPackable>
<IsUnitTestProject>true</IsUnitTestProject>
Expand Down
Loading