-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use platform runtime check for ProtectedData (#80158)
* Use platform runtime check for ProtectedData * Remove duplicate TargetFramework
- Loading branch information
Showing
4 changed files
with
58 additions
and
8 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
29 changes: 29 additions & 0 deletions
29
...braries/System.Security.Cryptography.ProtectedData/tests/ProtectedDataUnsupportedTests.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,29 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Security.Cryptography; | ||
|
||
using Xunit; | ||
|
||
namespace System.Security.Cryptography.ProtectedDataTests | ||
{ | ||
[PlatformSpecific(~TestPlatforms.Windows)] | ||
public static class ProtectedUnsupportedDataTests | ||
{ | ||
[Theory] | ||
[InlineData(DataProtectionScope.LocalMachine)] | ||
[InlineData(DataProtectionScope.CurrentUser)] | ||
public static void Protect_PlatformNotSupported(DataProtectionScope scope) | ||
{ | ||
Assert.Throws<PlatformNotSupportedException>(() => ProtectedData.Protect(null, null, scope)); | ||
} | ||
|
||
[Theory] | ||
[InlineData(DataProtectionScope.LocalMachine)] | ||
[InlineData(DataProtectionScope.CurrentUser)] | ||
public static void Unprotect_PlatformNotSupported(DataProtectionScope scope) | ||
{ | ||
Assert.Throws<PlatformNotSupportedException>(() => ProtectedData.Unprotect(null, null, scope)); | ||
} | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
....Cryptography.ProtectedData/tests/System.Security.Cryptography.ProtectedData.Tests.csproj
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