@@ -26,8 +26,7 @@ public abstract class SharedAuthenticationTests<TOptions> where TOptions : Authe
26
26
[ Fact ]
27
27
public async Task CanForwardDefault ( )
28
28
{
29
- var services = new ServiceCollection ( ) . AddLogging ( ) ;
30
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
29
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
31
30
32
31
var builder = services . AddAuthentication ( o =>
33
32
{
@@ -84,8 +83,7 @@ public async Task ForwardSignInWinsOverDefault()
84
83
{
85
84
if ( SupportsSignIn )
86
85
{
87
- var services = new ServiceCollection ( ) . AddLogging ( ) ;
88
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
86
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
89
87
90
88
var builder = services . AddAuthentication ( o =>
91
89
{
@@ -128,8 +126,7 @@ public async Task ForwardSignOutWinsOverDefault()
128
126
{
129
127
if ( SupportsSignOut )
130
128
{
131
- var services = new ServiceCollection ( ) . AddLogging ( ) ;
132
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
129
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
133
130
var builder = services . AddAuthentication ( o =>
134
131
{
135
132
o . DefaultScheme = DefaultScheme ;
@@ -169,8 +166,7 @@ public async Task ForwardSignOutWinsOverDefault()
169
166
[ Fact ]
170
167
public async Task ForwardForbidWinsOverDefault ( )
171
168
{
172
- var services = new ServiceCollection ( ) . AddLogging ( ) ;
173
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
169
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
174
170
var builder = services . AddAuthentication ( o =>
175
171
{
176
172
o . DefaultScheme = DefaultScheme ;
@@ -219,8 +215,7 @@ public Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
219
215
[ Fact ]
220
216
public async Task ForwardAuthenticateOnlyRunsTransformOnceByDefault ( )
221
217
{
222
- var services = new ServiceCollection ( ) . AddLogging ( ) ;
223
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
218
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
224
219
var transform = new RunOnce ( ) ;
225
220
var builder = services . AddSingleton < IClaimsTransformation > ( transform ) . AddAuthentication ( o =>
226
221
{
@@ -250,8 +245,7 @@ public async Task ForwardAuthenticateOnlyRunsTransformOnceByDefault()
250
245
[ Fact ]
251
246
public async Task ForwardAuthenticateWinsOverDefault ( )
252
247
{
253
- var services = new ServiceCollection ( ) . AddLogging ( ) ;
254
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
248
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
255
249
var builder = services . AddAuthentication ( o =>
256
250
{
257
251
o . DefaultScheme = DefaultScheme ;
@@ -290,8 +284,7 @@ public async Task ForwardAuthenticateWinsOverDefault()
290
284
[ Fact ]
291
285
public async Task ForwardChallengeWinsOverDefault ( )
292
286
{
293
- var services = new ServiceCollection ( ) . AddLogging ( ) ;
294
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
287
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
295
288
var builder = services . AddAuthentication ( o =>
296
289
{
297
290
o . DefaultScheme = DefaultScheme ;
@@ -330,8 +323,7 @@ public async Task ForwardChallengeWinsOverDefault()
330
323
[ Fact ]
331
324
public async Task ForwardSelectorWinsOverDefault ( )
332
325
{
333
- var services = new ServiceCollection ( ) . AddLogging ( ) ;
334
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
326
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
335
327
var builder = services . AddAuthentication ( o =>
336
328
{
337
329
o . DefaultScheme = DefaultScheme ;
@@ -400,8 +392,7 @@ public async Task ForwardSelectorWinsOverDefault()
400
392
[ Fact ]
401
393
public async Task NullForwardSelectorUsesDefault ( )
402
394
{
403
- var services = new ServiceCollection ( ) . AddLogging ( ) ;
404
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
395
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
405
396
var builder = services . AddAuthentication ( o =>
406
397
{
407
398
o . DefaultScheme = DefaultScheme ;
@@ -470,8 +461,7 @@ public async Task NullForwardSelectorUsesDefault()
470
461
[ Fact ]
471
462
public async Task SpecificForwardWinsOverSelectorAndDefault ( )
472
463
{
473
- var services = new ServiceCollection ( ) . AddLogging ( ) ;
474
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
464
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
475
465
var builder = services . AddAuthentication ( o =>
476
466
{
477
467
o . DefaultScheme = DefaultScheme ;
@@ -545,8 +535,7 @@ public async Task SpecificForwardWinsOverSelectorAndDefault()
545
535
[ Fact ]
546
536
public async Task VerifySchemeDefaults ( )
547
537
{
548
- var services = new ServiceCollection ( ) ;
549
- services . AddSingleton < IConfiguration > ( new ConfigurationManager ( ) ) ;
538
+ var services = new ServiceCollection ( ) . ConfigureAuthTestServices ( ) ;
550
539
var builder = services . AddAuthentication ( ) ;
551
540
RegisterAuth ( builder , o => { } ) ;
552
541
var sp = services . BuildServiceProvider ( ) ;
0 commit comments