@@ -12,12 +12,10 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Authentication;
12
12
13
13
public class WebAssemblyAuthenticationServiceCollectionExtensionsTests
14
14
{
15
- private static readonly JsonSerializerOptions JsonOptions = new ( ) ;
16
-
17
15
[ Fact ]
18
16
public void CanResolve_AccessTokenProvider ( )
19
17
{
20
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
18
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
21
19
builder . Services . AddApiAuthorization ( ) ;
22
20
var host = builder . Build ( ) ;
23
21
@@ -27,7 +25,7 @@ public void CanResolve_AccessTokenProvider()
27
25
[ Fact ]
28
26
public void CanResolve_IRemoteAuthenticationService ( )
29
27
{
30
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
28
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
31
29
builder . Services . AddApiAuthorization ( ) ;
32
30
var host = builder . Build ( ) ;
33
31
@@ -37,7 +35,7 @@ public void CanResolve_IRemoteAuthenticationService()
37
35
[ Fact ]
38
36
public void ApiAuthorizationOptions_ConfigurationDefaultsGetApplied ( )
39
37
{
40
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
38
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
41
39
builder . Services . AddApiAuthorization ( ) ;
42
40
var host = builder . Build ( ) ;
43
41
@@ -71,7 +69,7 @@ public void ApiAuthorizationOptions_ConfigurationDefaultsGetApplied()
71
69
[ Fact ]
72
70
public void ApiAuthorizationOptionsConfigurationCallback_GetsCalledOnce ( )
73
71
{
74
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
72
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
75
73
var calls = 0 ;
76
74
builder . Services . AddApiAuthorization ( options =>
77
75
{
@@ -98,7 +96,7 @@ public void ApiAuthorizationOptionsConfigurationCallback_GetsCalledOnce()
98
96
[ Fact ]
99
97
public void ApiAuthorizationTestAuthenticationState_SetsUpConfiguration ( )
100
98
{
101
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
99
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
102
100
var calls = 0 ;
103
101
builder . Services . AddApiAuthorization < TestAuthenticationState > ( options => calls ++ ) ;
104
102
@@ -124,7 +122,7 @@ public void ApiAuthorizationTestAuthenticationState_SetsUpConfiguration()
124
122
[ Fact ]
125
123
public void ApiAuthorizationTestAuthenticationState_NoCallback_SetsUpConfiguration ( )
126
124
{
127
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
125
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
128
126
builder . Services . AddApiAuthorization < TestAuthenticationState > ( ) ;
129
127
130
128
var host = builder . Build ( ) ;
@@ -147,7 +145,7 @@ public void ApiAuthorizationTestAuthenticationState_NoCallback_SetsUpConfigurati
147
145
[ Fact ]
148
146
public void ApiAuthorizationCustomAuthenticationStateAndAccount_SetsUpConfiguration ( )
149
147
{
150
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
148
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
151
149
var calls = 0 ;
152
150
builder . Services . AddApiAuthorization < TestAuthenticationState , TestAccount > ( options => calls ++ ) ;
153
151
@@ -173,7 +171,7 @@ public void ApiAuthorizationCustomAuthenticationStateAndAccount_SetsUpConfigurat
173
171
[ Fact ]
174
172
public void ApiAuthorizationTestAuthenticationStateAndAccount_NoCallback_SetsUpConfiguration ( )
175
173
{
176
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
174
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
177
175
builder . Services . AddApiAuthorization < TestAuthenticationState , TestAccount > ( ) ;
178
176
179
177
var host = builder . Build ( ) ;
@@ -196,7 +194,7 @@ public void ApiAuthorizationTestAuthenticationStateAndAccount_NoCallback_SetsUpC
196
194
[ Fact ]
197
195
public void ApiAuthorizationOptions_DefaultsCanBeOverriden ( )
198
196
{
199
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
197
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
200
198
builder . Services . AddApiAuthorization ( options =>
201
199
{
202
200
options . AuthenticationPaths . LogInPath = "a" ;
@@ -247,7 +245,7 @@ public void ApiAuthorizationOptions_DefaultsCanBeOverriden()
247
245
[ Fact ]
248
246
public void OidcOptions_ConfigurationDefaultsGetApplied ( )
249
247
{
250
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
248
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
251
249
builder . Services . Replace ( ServiceDescriptor . Singleton < NavigationManager , TestNavigationManager > ( ) ) ;
252
250
builder . Services . AddOidcAuthentication ( options => { } ) ;
253
251
var host = builder . Build ( ) ;
@@ -286,7 +284,7 @@ public void OidcOptions_ConfigurationDefaultsGetApplied()
286
284
[ Fact ]
287
285
public void OidcOptions_DefaultsCanBeOverriden ( )
288
286
{
289
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
287
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
290
288
builder . Services . AddOidcAuthentication ( options =>
291
289
{
292
290
options . AuthenticationPaths . LogInPath = "a" ;
@@ -348,7 +346,7 @@ public void OidcOptions_DefaultsCanBeOverriden()
348
346
[ Fact ]
349
347
public void AddOidc_ConfigurationGetsCalledOnce ( )
350
348
{
351
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
349
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
352
350
var calls = 0 ;
353
351
354
352
builder . Services . AddOidcAuthentication ( options => calls ++ ) ;
@@ -365,7 +363,7 @@ public void AddOidc_ConfigurationGetsCalledOnce()
365
363
[ Fact ]
366
364
public void AddOidc_CustomState_SetsUpConfiguration ( )
367
365
{
368
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
366
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
369
367
var calls = 0 ;
370
368
371
369
builder . Services . AddOidcAuthentication < TestAuthenticationState > ( options => options . ProviderOptions . Authority = ( ++ calls ) . ToString ( CultureInfo . InvariantCulture ) ) ;
@@ -387,7 +385,7 @@ public void AddOidc_CustomState_SetsUpConfiguration()
387
385
[ Fact ]
388
386
public void AddOidc_CustomStateAndAccount_SetsUpConfiguration ( )
389
387
{
390
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
388
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
391
389
var calls = 0 ;
392
390
393
391
builder . Services . AddOidcAuthentication < TestAuthenticationState , TestAccount > ( options => options . ProviderOptions . Authority = ( ++ calls ) . ToString ( CultureInfo . InvariantCulture ) ) ;
@@ -409,7 +407,7 @@ public void AddOidc_CustomStateAndAccount_SetsUpConfiguration()
409
407
[ Fact ]
410
408
public void OidcProviderOptionsAndDependencies_NotResolvedFromRootScope ( )
411
409
{
412
- var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) , JsonOptions ) ;
410
+ var builder = new WebAssemblyHostBuilder ( new TestInternalJSImportMethods ( ) ) ;
413
411
414
412
var calls = 0 ;
415
413
0 commit comments