File tree Expand file tree Collapse file tree
CodeBeam.UltimateAuth.Tests.Integration
CodeBeam.UltimateAuth.Tests.Unit Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using CodeBeam . UltimateAuth . Tests . Integration . Infrastructure ;
2+ using FluentAssertions ;
3+ using Microsoft . AspNetCore . Mvc . Testing ;
4+
5+ public sealed class UAuthHubSampleSmokeTests : IClassFixture < AuthServerFactory >
6+ {
7+ private readonly HttpClient _client ;
8+
9+ public UAuthHubSampleSmokeTests ( AuthServerFactory factory )
10+ {
11+ _client = factory . CreateClient (
12+ new WebApplicationFactoryClientOptions
13+ {
14+ AllowAutoRedirect = false
15+ } ) ;
16+ }
17+
18+ [ Theory ]
19+ [ InlineData ( "/" ) ]
20+ [ InlineData ( "/login" ) ]
21+ public async Task CriticalPages_ShouldRenderWithoutServerError ( string path )
22+ {
23+ var response = await _client . GetAsync ( path ) ;
24+
25+ ( ( int ) response . StatusCode )
26+ . Should ( )
27+ . BeLessThan ( 500 ) ;
28+ }
29+ }
Original file line number Diff line number Diff line change 2626 </ItemGroup >
2727
2828 <ItemGroup >
29+ <ProjectReference Include =" ..\..\samples\UAuthHub\CodeBeam.UltimateAuth.Sample.UAuthHub\CodeBeam.UltimateAuth.Sample.UAuthHub.csproj" />
2930 <ProjectReference Include =" ..\..\src\bundle\CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle\CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle.csproj" />
3031 <ProjectReference Include =" ..\..\src\bundle\CodeBeam.UltimateAuth.InMemory.Bundle\CodeBeam.UltimateAuth.InMemory.Bundle.csproj" />
3132 <ProjectReference Include =" ..\..\samples\CodeBeam.UltimateAuth.Sample.Seed\CodeBeam.UltimateAuth.Sample.Seed.csproj" />
Original file line number Diff line number Diff line change 1+ using Bunit ;
2+ using CodeBeam . UltimateAuth . Client . Blazor . Extensions ;
3+ using CodeBeam . UltimateAuth . InMemory ;
4+ using CodeBeam . UltimateAuth . Server . Extensions ;
5+ using Microsoft . Extensions . Configuration ;
6+ using Microsoft . Extensions . DependencyInjection ;
7+ using MudBlazor . Services ;
8+ using MudExtensions . Services ;
9+
10+ namespace CodeBeam . UltimateAuth . Tests . Unit . Samples ;
11+
12+ public abstract class UAuthHubComponentTestBase : BunitContext
13+ {
14+ protected UAuthHubComponentTestBase ( )
15+ {
16+ JSInterop . Mode = JSRuntimeMode . Loose ;
17+
18+ var configuration = new ConfigurationBuilder ( ) . AddInMemoryCollection ( ) . Build ( ) ;
19+
20+ Services . AddSingleton < IConfiguration > ( configuration ) ;
21+
22+ Services . AddMudServices ( ) ;
23+ Services . AddMudExtensions ( ) ;
24+ Services . AddUltimateAuthServer ( ) . AddUltimateAuthInMemory ( ) . AddUAuthHub ( ) ;
25+ Services . AddUltimateAuthClientBlazor ( ) ;
26+ }
27+ }
Original file line number Diff line number Diff line change 1+ using Bunit ;
2+ using CodeBeam . UltimateAuth . Client ;
3+ using CodeBeam . UltimateAuth . Sample . UAuthHub . Components . Layout ;
4+ using CodeBeam . UltimateAuth . Sample . UAuthHub . Components . Pages ;
5+ using FluentAssertions ;
6+ using Microsoft . AspNetCore . Components ;
7+
8+ namespace CodeBeam . UltimateAuth . Tests . Unit . Samples . UAuthHub ;
9+
10+ public sealed class HomeTests : UAuthHubComponentTestBase
11+ {
12+ [ Fact ]
13+ public void Home_ShouldRender ( )
14+ {
15+ var state = UAuthState . Anonymous ( ) ;
16+
17+ var act = ( ) => Render < CascadingValue < UAuthState > > ( parameters => parameters
18+ . Add ( p => p . Value , state )
19+ . AddChildContent < Home > ( ) ) ;
20+
21+ act . Should ( ) . NotThrow ( ) ;
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments