1using Microsoft.VisualStudio.TestTools.UnitTesting;
6using Microsoft.AspNetCore.Components.Authorization;
7using System.Threading.Tasks;
8using System.Collections.Generic;
18 public void CorrectManagerChosen()
20 IServiceCollection services =
new ServiceCollection();
21 services.AddHttpContextAccessor();
24 services.AddCsla(c => c
26 .AddServerSideBlazor()
28 IServiceProvider provider = services.BuildServiceProvider();
29 var managers = provider.GetRequiredService<IEnumerable<IContextManager>>();
30 Assert.IsTrue(managers.Count() == 2);
31 var blazorMgr = (
Csla.
AspNetCore.Blazor.ApplicationContextManagerBlazor)managers.FirstOrDefault(mgr => mgr is
Csla.
AspNetCore.Blazor.ApplicationContextManagerBlazor);
33 Assert.IsNotNull(blazorMgr);
34 Assert.IsTrue(blazorMgr.IsStatefulContext);
35 Assert.IsFalse(blazorMgr.IsValid);
38 Assert.IsNotNull(httpMgr);
39 Assert.IsFalse(httpMgr.IsStatefulContext);
40 Assert.IsFalse(httpMgr.IsValid);
44 Assert.IsNotNull(appContext);
54 => Task.FromResult<AuthenticationState>(
null);
Provides consistent context information between the client and server DataPortal objects.
Application context manager that uses HttpContextAccessor when resolving HttpContext to store context...
override Task< AuthenticationState > GetAuthenticationStateAsync()
Application context manager using AsyncLocal for user and context dictionaries.