This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +87
-1
lines changed
src/System.Net.Security/tests/UnitTests
System/Security/Authentication Expand file tree Collapse file tree 3 files changed +87
-1
lines changed Original file line number Diff line number Diff line change 2424 <Compile Include =" SslApplicationProtocolTests.cs" />
2525 <Compile Include =" SslAuthenticationOptionsTests.cs" />
2626 <Compile Include =" SslStreamAllowedProtocolsTest.cs" />
27+ <Compile Include =" System\Security\Authentication\AuthenticationExceptionTest.cs" />
2728 <Compile Include =" System\Security\Authentication\ExtendedProtection\ExtendedProtectionPolicyTest.cs" />
29+ <Compile Include =" System\Security\Authentication\InvalidCredentialExceptionTest.cs" />
2830 <Compile Include =" TlsAlertsMatchWindowsInterop.cs" />
2931 <!-- Fakes -->
3032 <Compile Include =" Fakes\FakeSslState.cs" />
8486 <Reference Include =" System.Threading.Tasks" />
8587 </ItemGroup >
8688 <Import Project =" $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
87- </Project >
89+ </Project >
Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+ // See the LICENSE file in the project root for more information.
4+
5+ using System . Security . Authentication ;
6+ using Xunit ;
7+
8+ namespace System . Net . Security . Tests
9+ {
10+ public class AuthenticationExceptionTest
11+ {
12+ [ Fact ]
13+ public void Constructor_NoParameter_DefaultMessageIsNotNull ( )
14+ {
15+ AuthenticationException authenticationException = new AuthenticationException ( ) ;
16+
17+ Assert . NotNull ( authenticationException . Message ) ;
18+ }
19+
20+ [ Fact ]
21+ public void Constructor_String_PassedInMessageCorrect ( )
22+ {
23+ const string passedInMessage = "base was called" ;
24+
25+ AuthenticationException authenticationException = new AuthenticationException ( passedInMessage ) ;
26+
27+ Assert . Equal ( passedInMessage , authenticationException . Message ) ;
28+ }
29+
30+ [ Fact ]
31+ public void Constructor_String_Exception_MessagesCorrect ( )
32+ {
33+ const string passedInMessage = "base was called" ;
34+ const string innerExceptionMessage = "this is the inner exception message" ;
35+
36+ AuthenticationException authenticationException = new AuthenticationException ( passedInMessage , new Exception ( innerExceptionMessage ) ) ;
37+
38+ Assert . Equal ( passedInMessage , authenticationException . Message ) ;
39+ Assert . Equal ( innerExceptionMessage , authenticationException . InnerException . Message ) ;
40+ }
41+ }
42+ }
Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+ // See the LICENSE file in the project root for more information.
4+
5+ using System . Security . Authentication ;
6+ using Xunit ;
7+
8+ namespace System . Net . Security . Tests
9+ {
10+ public class InvalidCredentialExceptionTest
11+ {
12+ [ Fact ]
13+ public void Constructor_NoParameter_DefaultMessageIsNotNull ( )
14+ {
15+ InvalidCredentialException invalidCredentialException = new InvalidCredentialException ( ) ;
16+
17+ Assert . NotNull ( invalidCredentialException . Message ) ;
18+ }
19+
20+ [ Fact ]
21+ public void Constructor_String_PassedInMessageCorrect ( )
22+ {
23+ const string passedInMessage = "base was called" ;
24+
25+ InvalidCredentialException invalidCredentialException = new InvalidCredentialException ( passedInMessage ) ;
26+
27+ Assert . Equal ( passedInMessage , invalidCredentialException . Message ) ;
28+ }
29+
30+ [ Fact ]
31+ public void Constructor_String_Exception_MessagesCorrect ( )
32+ {
33+ const string passedInMessage = "base was called" ;
34+ const string innerExceptionMessage = "this is the inner exception message" ;
35+
36+ InvalidCredentialException invalidCredentialException = new InvalidCredentialException ( passedInMessage , new Exception ( innerExceptionMessage ) ) ;
37+
38+ Assert . Equal ( passedInMessage , invalidCredentialException . Message ) ;
39+ Assert . Equal ( innerExceptionMessage , invalidCredentialException . InnerException . Message ) ;
40+ }
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments