1
1
using Dotnet . Samples . AspNetCore . WebApi . Controllers ;
2
2
using Dotnet . Samples . AspNetCore . WebApi . Models ;
3
3
using Dotnet . Samples . AspNetCore . WebApi . Services ;
4
+ using Dotnet . Samples . AspNetCore . WebApi . Tests . Utilities ;
4
5
using FluentAssertions ;
5
6
using Microsoft . AspNetCore . Http ;
6
7
using Microsoft . AspNetCore . Http . HttpResults ;
7
8
using Moq ;
8
9
9
- namespace Dotnet . Samples . AspNetCore . WebApi . Tests ;
10
+ namespace Dotnet . Samples . AspNetCore . WebApi . Tests . Unit ;
10
11
11
12
public class PlayerControllerTests
12
13
{
@@ -15,7 +16,7 @@ public class PlayerControllerTests
15
16
* ---------------------------------------------------------------------- */
16
17
17
18
[ Fact ]
18
- [ Trait ( "Category" , "PostAsync " ) ]
19
+ [ Trait ( "Category" , "Unit " ) ]
19
20
public async Task GivenPostAsync_WhenModelStateIsInvalid_ThenResponseStatusCodeShouldBe400BadRequest ( )
20
21
{
21
22
// Arrange
@@ -34,7 +35,7 @@ public async Task GivenPostAsync_WhenModelStateIsInvalid_ThenResponseStatusCodeS
34
35
}
35
36
36
37
[ Fact ]
37
- [ Trait ( "Category" , "PostAsync " ) ]
38
+ [ Trait ( "Category" , "Unit " ) ]
38
39
public async Task GivenPostAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenResponseStatusCodeShouldBe409Conflict ( )
39
40
{
40
41
// Arrange
@@ -55,7 +56,7 @@ public async Task GivenPostAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenR
55
56
}
56
57
57
58
[ Fact ]
58
- [ Trait ( "Category" , "PostAsync " ) ]
59
+ [ Trait ( "Category" , "Unit " ) ]
59
60
public async Task GivenPostAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenResponseStatusCodeShouldBe201Created ( )
60
61
{
61
62
// Arrange
@@ -88,7 +89,7 @@ public async Task GivenPostAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenRes
88
89
* ---------------------------------------------------------------------- */
89
90
90
91
[ Fact ]
91
- [ Trait ( "Category" , "GetAsync " ) ]
92
+ [ Trait ( "Category" , "Unit " ) ]
92
93
public async Task GivenGetAsync_WhenServiceRetrieveAsyncReturnsListOfPlayers_ThenResponseShouldBeEquivalentToListOfPlayers ( )
93
94
{
94
95
// Arrange
@@ -111,7 +112,7 @@ public async Task GivenGetAsync_WhenServiceRetrieveAsyncReturnsListOfPlayers_The
111
112
}
112
113
113
114
[ Fact ]
114
- [ Trait ( "Category" , "GetAsync " ) ]
115
+ [ Trait ( "Category" , "Unit " ) ]
115
116
public async Task GivenGetAsync_WhenServiceRetrieveAsyncReturnsEmptyList_ThenResponseStatusCodeShouldBe404NotFound ( )
116
117
{
117
118
// Arrange
@@ -132,7 +133,7 @@ public async Task GivenGetAsync_WhenServiceRetrieveAsyncReturnsEmptyList_ThenRes
132
133
}
133
134
134
135
[ Fact ]
135
- [ Trait ( "Category" , "GetByIdAsync " ) ]
136
+ [ Trait ( "Category" , "Unit " ) ]
136
137
public async Task GivenGetByIdAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenResponseStatusCodeShouldBe404NotFound ( )
137
138
{
138
139
// Arrange
@@ -154,7 +155,7 @@ public async Task GivenGetByIdAsync_WhenServiceRetrieveByIdAsyncReturnsNull_Then
154
155
}
155
156
156
157
[ Fact ]
157
- [ Trait ( "Category" , "GetByIdAsync " ) ]
158
+ [ Trait ( "Category" , "Unit " ) ]
158
159
public async Task GivenGetByIdAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenResponseStatusCodeShouldBe200Ok ( )
159
160
{
160
161
// Arrange
@@ -177,7 +178,7 @@ public async Task GivenGetByIdAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_Th
177
178
}
178
179
179
180
[ Fact ]
180
- [ Trait ( "Category" , "GetBySquadNumberAsync " ) ]
181
+ [ Trait ( "Category" , "Unit " ) ]
181
182
public async Task GivenGetBySquadNumberAsync_WhenServiceRetrieveBySquadNumberAsyncReturnsNull_ThenResponseStatusCodeShouldBe404NotFound ( )
182
183
{
183
184
// Arrange
@@ -202,7 +203,7 @@ public async Task GivenGetBySquadNumberAsync_WhenServiceRetrieveBySquadNumberAsy
202
203
}
203
204
204
205
[ Fact ]
205
- [ Trait ( "Category" , "GetBySquadNumberAsync " ) ]
206
+ [ Trait ( "Category" , "Unit " ) ]
206
207
public async Task GivenGetBySquadNumberAsync_WhenServiceRetrieveBySquadNumberAsyncReturnsPlayer_ThenResponseStatusCodeShouldBe200Ok ( )
207
208
{
208
209
// Arrange
@@ -234,7 +235,7 @@ public async Task GivenGetBySquadNumberAsync_WhenServiceRetrieveBySquadNumberAsy
234
235
* ---------------------------------------------------------------------- */
235
236
236
237
[ Fact ]
237
- [ Trait ( "Category" , "PutAsync " ) ]
238
+ [ Trait ( "Category" , "Unit " ) ]
238
239
public async Task GivenPutAsync_WhenModelStateIsInvalid_ThenResponseStatusCodeShouldBe400BadRequest ( )
239
240
{
240
241
// Arrange
@@ -254,7 +255,7 @@ public async Task GivenPutAsync_WhenModelStateIsInvalid_ThenResponseStatusCodeSh
254
255
}
255
256
256
257
[ Fact ]
257
- [ Trait ( "Category" , "PutAsync " ) ]
258
+ [ Trait ( "Category" , "Unit " ) ]
258
259
public async Task GivenPutAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenResponseStatusCodeShouldBe404NotFound ( )
259
260
{
260
261
// Arrange
@@ -276,7 +277,7 @@ public async Task GivenPutAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenResp
276
277
}
277
278
278
279
[ Fact ]
279
- [ Trait ( "Category" , "PutAsync " ) ]
280
+ [ Trait ( "Category" , "Unit " ) ]
280
281
public async Task GivenPutAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenResponseStatusCodeShouldBe204NoContent ( )
281
282
{
282
283
// Arrange
@@ -304,7 +305,7 @@ public async Task GivenPutAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenRe
304
305
* ---------------------------------------------------------------------- */
305
306
306
307
[ Fact ]
307
- [ Trait ( "Category" , "DeleteAsync " ) ]
308
+ [ Trait ( "Category" , "Unit " ) ]
308
309
public async Task GivenDeleteAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenResponseStatusCodeShouldBe404NotFound ( )
309
310
{
310
311
// Arrange
@@ -326,7 +327,7 @@ public async Task GivenDeleteAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenR
326
327
}
327
328
328
329
[ Fact ]
329
- [ Trait ( "Category" , "DeleteAsync " ) ]
330
+ [ Trait ( "Category" , "Unit " ) ]
330
331
public async Task GivenDeleteAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenResponseStatusCodeShouldBe204NoContent ( )
331
332
{
332
333
// Arrange
0 commit comments