CascadingAuthenticationState error #684
Replies: 2 comments 2 replies
-
Hey @ProjectFoxx can you post the whole test and component? |
Beta Was this translation helpful? Give feedback.
-
This are the test and component Test
Page: `@inject IModalService Modal @page "/articles" StandardPageLayout> AddArticle() |
Beta Was this translation helpful? Give feedback.
-
Hello all,
I hope you guys can help me with this error.
I have an error when i am rendering a page. I get a CascadingAuthenticationState error:
System.InvalidOperationException : Cannot resolve scoped service 'Microsoft.AspNetCore.Components.Authorization.CascadingAuthenticationState' from root provider. How can i fix this?
I already read this: https://bunit.dev/docs/test-doubles/faking-auth.html
I already did this
using var ctx = new TestContext();
TestAuthorizationContext authContext = ctx.AddTestAuthorization();
authContext.SetAuthorized("sffsdf.fsffe.com", AuthorizationState.Authorized);
authContext.SetRoles("Administrator");
But still get this error how can i fix this?
Beta Was this translation helpful? Give feedback.
All reactions