-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ranks): add ranks repository tests
- Loading branch information
1 parent
48354ac
commit 69aa418
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
test/Armory.Test/Ranks/Infrastructure/Persistence/InMemoryRanksRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System.Threading.Tasks; | ||
using Armory.Ranks.Domain; | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
|
||
namespace Armory.Test.Ranks.Infrastructure.Persistence | ||
{ | ||
[TestFixture] | ||
[Order(1)] | ||
public class InMemoryRanksRepository : RanksInfrastructureTestCase | ||
{ | ||
[Test] | ||
[Order(1)] | ||
public async Task Save_ShouldSaveRank() | ||
{ | ||
var rank = new Rank("Soldado"); | ||
await Repository.Save(rank); | ||
} | ||
|
||
[Test] | ||
[Order(2)] | ||
public async Task SearchAll_ShouldReturnsAllRanks() | ||
{ | ||
var ranks = await Repository.SearchAll(); | ||
ranks.Should().HaveCount(1); | ||
} | ||
|
||
[Test] | ||
[Order(3)] | ||
public async Task Find_ShouldReturnRank() | ||
{ | ||
var rank = await Repository.Find(1); | ||
|
||
rank.Id.Should().Be(1); | ||
rank.Name.Should().Be("Soldado"); | ||
} | ||
|
||
[Test] | ||
[Order(4)] | ||
public async Task Find_ShouldReturnNull() | ||
{ | ||
var rank = await Repository.Find(2); | ||
|
||
rank.Should().BeNull(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Armory.Ranks.Domain; | ||
|
||
namespace Armory.Test.Ranks | ||
{ | ||
public class RanksInfrastructureTestCase : ArmoryContextInfrastructureTestCase | ||
{ | ||
protected IRanksRepository Repository => GetService<IRanksRepository>(); | ||
} | ||
} |