Replace PlatformAbstractions with RuntimeInformation
This commit is contained in:
parent
20a365b778
commit
acb8732ffd
|
|
@ -4,6 +4,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption;
|
using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption;
|
||||||
|
|
@ -13,7 +14,6 @@ using Microsoft.AspNetCore.Testing.xunit;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
@ -260,7 +260,7 @@ namespace Microsoft.AspNetCore.DataProtection
|
||||||
|
|
||||||
private class ConditionalRunTestOnlyIfHkcuRegistryAvailable : Attribute, ITestCondition
|
private class ConditionalRunTestOnlyIfHkcuRegistryAvailable : Attribute, ITestCondition
|
||||||
{
|
{
|
||||||
public bool IsMet => (PlatformServices.Default.Runtime.OperatingSystem == "Windows" && LazyHkcuTempKey.Value != null);
|
public bool IsMet => (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && LazyHkcuTempKey.Value != null);
|
||||||
|
|
||||||
public string SkipReason { get; } = "HKCU registry couldn't be opened.";
|
public string SkipReason { get; } = "HKCU registry couldn't be opened.";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
@ -159,7 +159,7 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories
|
||||||
|
|
||||||
private class ConditionalRunTestOnlyIfHkcuRegistryAvailable : Attribute, ITestCondition
|
private class ConditionalRunTestOnlyIfHkcuRegistryAvailable : Attribute, ITestCondition
|
||||||
{
|
{
|
||||||
public bool IsMet => (PlatformServices.Default.Runtime.OperatingSystem == "Windows" && LazyHkcuTempKey.Value != null);
|
public bool IsMet => (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && LazyHkcuTempKey.Value != null);
|
||||||
|
|
||||||
public string SkipReason { get; } = "HKCU registry couldn't be opened.";
|
public string SkipReason { get; } = "HKCU registry couldn't be opened.";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0-*",
|
||||||
"dotnet-test-xunit": "1.0.0-*",
|
"dotnet-test-xunit": "1.0.0-*",
|
||||||
"Microsoft.NETCore.Platforms": "1.0.1-*",
|
"Microsoft.NETCore.Platforms": "1.0.1-*",
|
||||||
"Microsoft.AspNetCore.DataProtection": "1.0.0-*",
|
"Microsoft.AspNetCore.DataProtection": "1.0.0-*",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue