-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix for #398 * Adding unit tests
- Loading branch information
Showing
3 changed files
with
67 additions
and
9 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
tests/Microsoft.Identity.Web.Test/ExcecptionHandlingTest.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,32 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Security.Claims; | ||
using Microsoft.Identity.Client; | ||
using NSubstitute; | ||
using Xunit; | ||
|
||
namespace Microsoft.Identity.Web.Test | ||
{ | ||
public class ExcecptionHandlingTest | ||
{ | ||
[Fact] | ||
public void AuthorizeForScopesAttribute_FindMsalUiRequiredExceptionIfAny_Tests() | ||
{ | ||
MsalUiRequiredException msalUiRequiredException = new MsalUiRequiredException("code", "message"); | ||
|
||
MsalUiRequiredException result = AuthorizeForScopesAttribute.FindMsalUiRequiredExceptionIfAny(msalUiRequiredException); | ||
Assert.Equal(result, msalUiRequiredException); | ||
|
||
Exception ex = new Exception("message", msalUiRequiredException); | ||
result = AuthorizeForScopesAttribute.FindMsalUiRequiredExceptionIfAny(ex); | ||
Assert.Equal(result, msalUiRequiredException); | ||
|
||
Exception ex2 = new Exception("message", ex); | ||
result = AuthorizeForScopesAttribute.FindMsalUiRequiredExceptionIfAny(ex2); | ||
Assert.Equal(result, msalUiRequiredException); | ||
} | ||
} | ||
} |