@@ -23,14 +23,14 @@ public async Task ReadingEmptySessionDoesNotCreateCookie()
23
23
{
24
24
using ( var server = TestServer . Create ( app =>
25
25
{
26
- app . UseServices ( services => services . AddOptions ( ) ) ;
27
26
app . UseInMemorySession ( ) ;
28
27
app . Run ( context =>
29
28
{
30
29
Assert . Null ( context . Session . GetString ( "NotFound" ) ) ;
31
30
return Task . FromResult ( 0 ) ;
32
31
} ) ;
33
- } ) )
32
+ } ,
33
+ services => services . AddOptions ( ) ) )
34
34
{
35
35
var client = server . CreateClient ( ) ;
36
36
var response = await client . GetAsync ( "/" ) ;
@@ -45,7 +45,6 @@ public async Task SettingAValueCausesTheCookieToBeCreated()
45
45
{
46
46
using ( var server = TestServer . Create ( app =>
47
47
{
48
- app . UseServices ( services => services . AddOptions ( ) ) ;
49
48
app . UseInMemorySession ( ) ;
50
49
app . Run ( context =>
51
50
{
@@ -54,7 +53,8 @@ public async Task SettingAValueCausesTheCookieToBeCreated()
54
53
Assert . Equal ( "Value" , context . Session . GetString ( "Key" ) ) ;
55
54
return Task . FromResult ( 0 ) ;
56
55
} ) ;
57
- } ) )
56
+ } ,
57
+ services => services . AddOptions ( ) ) )
58
58
{
59
59
var client = server . CreateClient ( ) ;
60
60
var response = await client . GetAsync ( "/" ) ;
@@ -71,7 +71,6 @@ public async Task SessionCanBeAccessedOnTheNextRequest()
71
71
{
72
72
using ( var server = TestServer . Create ( app =>
73
73
{
74
- app . UseServices ( services => services . AddOptions ( ) ) ;
75
74
app . UseInMemorySession ( ) ;
76
75
app . Run ( context =>
77
76
{
@@ -85,7 +84,8 @@ public async Task SessionCanBeAccessedOnTheNextRequest()
85
84
context . Session . SetInt ( "Key" , value . Value + 1 ) ;
86
85
return context . Response . WriteAsync ( value . Value . ToString ( ) ) ;
87
86
} ) ;
88
- } ) )
87
+ } ,
88
+ services => services . AddOptions ( ) ) )
89
89
{
90
90
var client = server . CreateClient ( ) ;
91
91
var response = await client . GetAsync ( "/first" ) ;
@@ -105,7 +105,6 @@ public async Task RemovedItemCannotBeAccessedAgain()
105
105
{
106
106
using ( var server = TestServer . Create ( app =>
107
107
{
108
- app . UseServices ( services => services . AddOptions ( ) ) ;
109
108
app . UseInMemorySession ( ) ;
110
109
app . Run ( context =>
111
110
{
@@ -129,7 +128,8 @@ public async Task RemovedItemCannotBeAccessedAgain()
129
128
}
130
129
return context . Response . WriteAsync ( value . Value . ToString ( ) ) ;
131
130
} ) ;
132
- } ) )
131
+ } ,
132
+ services => services . AddOptions ( ) ) )
133
133
{
134
134
var client = server . CreateClient ( ) ;
135
135
var response = await client . GetAsync ( "/first" ) ;
@@ -148,7 +148,6 @@ public async Task ClearedItemsCannotBeAccessedAgain()
148
148
{
149
149
using ( var server = TestServer . Create ( app =>
150
150
{
151
- app . UseServices ( services => services . AddOptions ( ) ) ;
152
151
app . UseInMemorySession ( ) ;
153
152
app . Run ( context =>
154
153
{
@@ -172,7 +171,8 @@ public async Task ClearedItemsCannotBeAccessedAgain()
172
171
}
173
172
return context . Response . WriteAsync ( value . Value . ToString ( ) ) ;
174
173
} ) ;
175
- } ) )
174
+ } ,
175
+ services => services . AddOptions ( ) ) )
176
176
{
177
177
var client = server . CreateClient ( ) ;
178
178
var response = await client . GetAsync ( "/first" ) ;
@@ -193,17 +193,17 @@ public async Task SessionStart_LogsInformation()
193
193
var loggerFactory = new TestLoggerFactory ( sink , enabled : true ) ;
194
194
using ( var server = TestServer . Create ( app =>
195
195
{
196
- app . UseServices ( services =>
197
- {
198
- services . AddOptions ( ) ;
199
- services . AddInstance ( typeof ( ILoggerFactory ) , loggerFactory ) ;
200
- } ) ;
201
196
app . UseInMemorySession ( ) ;
202
197
app . Run ( context =>
203
198
{
204
199
context . Session . SetString ( "Key" , "Value" ) ;
205
200
return Task . FromResult ( 0 ) ;
206
201
} ) ;
202
+ } ,
203
+ services =>
204
+ {
205
+ services . AddOptions ( ) ;
206
+ services . AddInstance ( typeof ( ILoggerFactory ) , loggerFactory ) ;
207
207
} ) )
208
208
{
209
209
var client = server . CreateClient ( ) ;
@@ -222,11 +222,6 @@ public async Task ExpiredSession_LogsWarning()
222
222
var loggerFactory = new TestLoggerFactory ( sink , enabled : true ) ;
223
223
using ( var server = TestServer . Create ( app =>
224
224
{
225
- app . UseServices ( services =>
226
- {
227
- services . AddOptions ( ) ;
228
- services . AddInstance ( typeof ( ILoggerFactory ) , loggerFactory ) ;
229
- } ) ;
230
225
app . UseInMemorySession ( configure : o => {
231
226
o . IdleTimeout = TimeSpan . FromMilliseconds ( 30 ) ;
232
227
} ) ;
@@ -246,6 +241,11 @@ public async Task ExpiredSession_LogsWarning()
246
241
}
247
242
return context . Response . WriteAsync ( value . Value . ToString ( ) ) ;
248
243
} ) ;
244
+ } ,
245
+ services =>
246
+ {
247
+ services . AddOptions ( ) ;
248
+ services . AddInstance ( typeof ( ILoggerFactory ) , loggerFactory ) ;
249
249
} ) )
250
250
{
251
251
var client = server . CreateClient ( ) ;
0 commit comments