active-directory-aspnetcore-webapp-openidconnect-v2
active-directory-aspnetcore-webapp-openidconnect-v2 copied to clipboard
Please add an example of how to test
This issue is for a: (mark with an x)
- [ ] bug report -> please search issues before submitting
- [x] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
The issue was found for the following scenario:
Please add an 'x' for the scenario(s) where you found an issue
- Web app that signs in users
- [x] with a work and school account in your organization: 1-WebApp-OIDC/1-1-MyOrg
- [x] with any work and school account: /1-WebApp-OIDC/1-2-AnyOrg
- [x] with any work or school account or Microsoft personal account: 1-WebApp-OIDC/1-3-AnyOrgOrPersonal
- [x] with users in National or sovereign clouds 1-WebApp-OIDC/1-4-Sovereign
- [x] with B2C users 1-WebApp-OIDC/1-5-B2C
- Web app that calls Microsoft Graph
- [x] Calling graph with the Microsoft Graph SDK: 2-WebApp-graph-user/2-1-Call-MSGraph
- [x] With specific token caches: 2-WebApp-graph-user/2-2-TokenCache
- [x] Calling Microsoft Graph in national clouds: 2-WebApp-graph-user/2-4-Sovereign-Call-MSGraph
- [x] Web app calling several APIs 3-WebApp-multi-APIs
- [x] Web app calling your own Web API 4-WebApp-your-API
- Web app restricting users
- [x] by Roles: 5-WebApp-AuthZ/5-1-Roles
- [x] by Groups: 5-WebApp-AuthZ/5-2-Groups
- [ ] Deployment to Azure
- [ ] Other (please describe)
Repro-ing the issue
Repro steps
N/A
Expected behavior
N/A
Actual behavior
N/A
Possible Solution
Add test cases e.g. using WebApplicationFactory
Additional context/ Error codes / Screenshots
N/A
Any log messages given by the failure
N/A
OS and Version?
N/A
Versions
N/A
Attempting to troubleshooting yourself:
I tried to use the examples here: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-3.1#mock-authentication but Azure AD auth fails before the Test handler can run.
Mention any other details that might be useful
You guys are awesome. Thanks so much for the examples.
Hi @jamiemccrindle, we are planning in creating a chapter to talk about unit test in this tutorial. In the mean time, you have these tests from MSAL library as a reference.
This is quite belated and possibly not relevant anymore but for anyone interested please follow the tutorial series here.
Closing.