Skip to content

Commit e498f3b

Browse files
committed
feat(data)!: implement Repository pattern
1 parent 2fe760c commit e498f3b

File tree

15 files changed

+531
-360
lines changed

15 files changed

+531
-360
lines changed

Dotnet.Samples.AspNetCore.WebApi.Tests/PlayerServiceTests.cs

Lines changed: 0 additions & 246 deletions
This file was deleted.

Dotnet.Samples.AspNetCore.WebApi.Tests/PlayerControllerTests.cs renamed to Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerControllerTests.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
using Dotnet.Samples.AspNetCore.WebApi.Controllers;
22
using Dotnet.Samples.AspNetCore.WebApi.Models;
33
using Dotnet.Samples.AspNetCore.WebApi.Services;
4+
using Dotnet.Samples.AspNetCore.WebApi.Tests.Utilities;
45
using FluentAssertions;
56
using Microsoft.AspNetCore.Http;
67
using Microsoft.AspNetCore.Http.HttpResults;
78
using Moq;
89

9-
namespace Dotnet.Samples.AspNetCore.WebApi.Tests;
10+
namespace Dotnet.Samples.AspNetCore.WebApi.Tests.Unit;
1011

1112
public class PlayerControllerTests
1213
{
@@ -15,7 +16,7 @@ public class PlayerControllerTests
1516
* ---------------------------------------------------------------------- */
1617

1718
[Fact]
18-
[Trait("Category", "PostAsync")]
19+
[Trait("Category", "Unit")]
1920
public async Task GivenPostAsync_WhenModelStateIsInvalid_ThenResponseStatusCodeShouldBe400BadRequest()
2021
{
2122
// Arrange
@@ -34,7 +35,7 @@ public async Task GivenPostAsync_WhenModelStateIsInvalid_ThenResponseStatusCodeS
3435
}
3536

3637
[Fact]
37-
[Trait("Category", "PostAsync")]
38+
[Trait("Category", "Unit")]
3839
public async Task GivenPostAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenResponseStatusCodeShouldBe409Conflict()
3940
{
4041
// Arrange
@@ -55,7 +56,7 @@ public async Task GivenPostAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenR
5556
}
5657

5758
[Fact]
58-
[Trait("Category", "PostAsync")]
59+
[Trait("Category", "Unit")]
5960
public async Task GivenPostAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenResponseStatusCodeShouldBe201Created()
6061
{
6162
// Arrange
@@ -88,7 +89,7 @@ public async Task GivenPostAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenRes
8889
* ---------------------------------------------------------------------- */
8990

9091
[Fact]
91-
[Trait("Category", "GetAsync")]
92+
[Trait("Category", "Unit")]
9293
public async Task GivenGetAsync_WhenServiceRetrieveAsyncReturnsListOfPlayers_ThenResponseShouldBeEquivalentToListOfPlayers()
9394
{
9495
// Arrange
@@ -111,7 +112,7 @@ public async Task GivenGetAsync_WhenServiceRetrieveAsyncReturnsListOfPlayers_The
111112
}
112113

113114
[Fact]
114-
[Trait("Category", "GetAsync")]
115+
[Trait("Category", "Unit")]
115116
public async Task GivenGetAsync_WhenServiceRetrieveAsyncReturnsEmptyList_ThenResponseStatusCodeShouldBe404NotFound()
116117
{
117118
// Arrange
@@ -132,7 +133,7 @@ public async Task GivenGetAsync_WhenServiceRetrieveAsyncReturnsEmptyList_ThenRes
132133
}
133134

134135
[Fact]
135-
[Trait("Category", "GetByIdAsync")]
136+
[Trait("Category", "Unit")]
136137
public async Task GivenGetByIdAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenResponseStatusCodeShouldBe404NotFound()
137138
{
138139
// Arrange
@@ -154,7 +155,7 @@ public async Task GivenGetByIdAsync_WhenServiceRetrieveByIdAsyncReturnsNull_Then
154155
}
155156

156157
[Fact]
157-
[Trait("Category", "GetByIdAsync")]
158+
[Trait("Category", "Unit")]
158159
public async Task GivenGetByIdAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenResponseStatusCodeShouldBe200Ok()
159160
{
160161
// Arrange
@@ -177,7 +178,7 @@ public async Task GivenGetByIdAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_Th
177178
}
178179

179180
[Fact]
180-
[Trait("Category", "GetBySquadNumberAsync")]
181+
[Trait("Category", "Unit")]
181182
public async Task GivenGetBySquadNumberAsync_WhenServiceRetrieveBySquadNumberAsyncReturnsNull_ThenResponseStatusCodeShouldBe404NotFound()
182183
{
183184
// Arrange
@@ -202,7 +203,7 @@ public async Task GivenGetBySquadNumberAsync_WhenServiceRetrieveBySquadNumberAsy
202203
}
203204

204205
[Fact]
205-
[Trait("Category", "GetBySquadNumberAsync")]
206+
[Trait("Category", "Unit")]
206207
public async Task GivenGetBySquadNumberAsync_WhenServiceRetrieveBySquadNumberAsyncReturnsPlayer_ThenResponseStatusCodeShouldBe200Ok()
207208
{
208209
// Arrange
@@ -234,7 +235,7 @@ public async Task GivenGetBySquadNumberAsync_WhenServiceRetrieveBySquadNumberAsy
234235
* ---------------------------------------------------------------------- */
235236

236237
[Fact]
237-
[Trait("Category", "PutAsync")]
238+
[Trait("Category", "Unit")]
238239
public async Task GivenPutAsync_WhenModelStateIsInvalid_ThenResponseStatusCodeShouldBe400BadRequest()
239240
{
240241
// Arrange
@@ -254,7 +255,7 @@ public async Task GivenPutAsync_WhenModelStateIsInvalid_ThenResponseStatusCodeSh
254255
}
255256

256257
[Fact]
257-
[Trait("Category", "PutAsync")]
258+
[Trait("Category", "Unit")]
258259
public async Task GivenPutAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenResponseStatusCodeShouldBe404NotFound()
259260
{
260261
// Arrange
@@ -276,7 +277,7 @@ public async Task GivenPutAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenResp
276277
}
277278

278279
[Fact]
279-
[Trait("Category", "PutAsync")]
280+
[Trait("Category", "Unit")]
280281
public async Task GivenPutAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenResponseStatusCodeShouldBe204NoContent()
281282
{
282283
// Arrange
@@ -304,7 +305,7 @@ public async Task GivenPutAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenRe
304305
* ---------------------------------------------------------------------- */
305306

306307
[Fact]
307-
[Trait("Category", "DeleteAsync")]
308+
[Trait("Category", "Unit")]
308309
public async Task GivenDeleteAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenResponseStatusCodeShouldBe404NotFound()
309310
{
310311
// Arrange
@@ -326,7 +327,7 @@ public async Task GivenDeleteAsync_WhenServiceRetrieveByIdAsyncReturnsNull_ThenR
326327
}
327328

328329
[Fact]
329-
[Trait("Category", "DeleteAsync")]
330+
[Trait("Category", "Unit")]
330331
public async Task GivenDeleteAsync_WhenServiceRetrieveByIdAsyncReturnsPlayer_ThenResponseStatusCodeShouldBe204NoContent()
331332
{
332333
// Arrange

0 commit comments

Comments
 (0)