Address build warning in test assembly
This commit is contained in:
Marc Paine 2024-03-04 11:21:48 -08:00
Родитель 6d60e11a4a
Коммит 5300d380b5
2 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -8,6 +8,7 @@ using System.CommandLine.Builder;
using System.CommandLine.Invocation;
using System.CommandLine.Parsing;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.DotNet.Tools.Uninstall.MacOs;
using Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo;
using Microsoft.DotNet.Tools.Uninstall.Shared.Commands;
@ -231,7 +232,7 @@ namespace Microsoft.DotNet.Tools.Uninstall.Shared.Configs
}
AssignOptionsToCommand(ListCommand, ListAuxOptions);
var bundleCollector = RuntimeInfo.RunningOnWindows ? new RegistryQuery() as IBundleCollector : new FileSystemExplorer() as IBundleCollector;
var bundleCollector = OperatingSystem.IsWindows() ? new RegistryQuery() as IBundleCollector : new FileSystemExplorer() as IBundleCollector;
ListCommand.Handler = CommandHandler.Create(ExceptionHandler.HandleException(() => ListCommandExec.Execute(bundleCollector)));
DryRunCommand.Handler = CommandHandler.Create(ExceptionHandler.HandleException(() => DryRunCommandExec.Execute(bundleCollector)));
RemoveCommand.Handler = CommandHandler.Create(ExceptionHandler.HandleException(() => UninstallCommandExec.Execute(bundleCollector)));

Просмотреть файл

@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using FluentAssertions;
using Microsoft.DotNet.Tools.Uninstall.Tests.Attributes;
using Microsoft.DotNet.Tools.Uninstall.Windows;
@ -48,9 +49,12 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tests.Windows
[InlineData("Microsoft .NET SDK 5.0.100 (arm64)")]
internal void TestIsNetCoreBundleAccept(string input)
{
RegistryQuery.IsNetCoreBundle(input, "0.0", "mockuninstall.exe", "0.0")
.Should()
.BeTrue();
if (OperatingSystem.IsWindows())
{
RegistryQuery.IsNetCoreBundle(input, "0.0", "mockuninstall.exe", "0.0")
.Should()
.BeTrue();
}
}
[WindowsOnlyTheory]
@ -58,9 +62,12 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tests.Windows
[InlineData("Microsoft .NET Core SDK - rc1 (x86)")]
internal void TestGetBundleVersionReturnsNullOnInvalidDisplayNames(string displayName)
{
RegistryQuery.GetBundleVersion(displayName, string.Empty, string.Empty)
if (OperatingSystem.IsWindows())
{
RegistryQuery.GetBundleVersion(displayName, string.Empty, string.Empty)
.Should()
.BeNull();
}
}
}
}