-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switched to FluentAssertions from Shouldly - FluentAssertions has bet…
…ter API
- Loading branch information
1 parent
bd82d16
commit 609e4bc
Showing
9 changed files
with
40 additions
and
36 deletions.
There are no files selected for viewing
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
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
2 changes: 1 addition & 1 deletion
2
...Boilerplate.Api.IntegrationTests/HappyCode.NetCoreBoilerplate.Api.IntegrationTests.csproj
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -3,12 +3,12 @@ | |
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using FluentAssertions; | ||
using HappyCode.NetCoreBoilerplate.Core.Models; | ||
using HappyCode.NetCoreBoilerplate.Core.Repositories; | ||
using HappyCode.NetCoreBoilerplate.Core.UnitTests.Infrastructure; | ||
using Microsoft.EntityFrameworkCore; | ||
using Moq; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
namespace HappyCode.NetCoreBoilerplate.Core.UnitTests.Repositories | ||
|
@@ -41,8 +41,10 @@ public async Task GetOldestAsync_should_return_expected_employee() | |
var emp = await _repository.GetOldestAsync(default); | ||
|
||
//then | ||
emp.Id.ShouldBe(45); | ||
emp.LastName.ShouldBe("Hudson"); | ||
emp.Id.Should().Be(45); | ||
emp.LastName.Should() | ||
.NotBeNullOrEmpty() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lkurzyniec
Author
Owner
|
||
.And.Be("Hudson"); | ||
} | ||
|
||
[Fact] | ||
|
@@ -55,7 +57,7 @@ public async Task DeleteByIdAsync_should_return_false_when_employee_not_found() | |
var result = await _repository.DeleteByIdAsync(99, default); | ||
|
||
//then | ||
result.ShouldBe(false); | ||
result.Should().Be(false); | ||
|
||
_dbContextMock.Verify(x => x.SaveChangesAsync(It.IsAny<CancellationToken>()), Times.Never); | ||
} | ||
|
@@ -79,7 +81,7 @@ public async Task DeleteByIdAsync_should_return_true_and_save_when_employee_foun | |
var result = await _repository.DeleteByIdAsync(empId, default); | ||
|
||
//then | ||
result.ShouldBe(true); | ||
result.Should().Be(true); | ||
|
||
_dbContextMock.Verify(x => x.Employees.Remove(It.Is<Employee>(y => y.EmpNo == empId)), Times.Once); | ||
_dbContextMock.Verify(x => x.SaveChangesAsync(It.IsAny<CancellationToken>()), Times.Once); | ||
|
There is no need to do
.NotBeNullOrEmpty()
..Should().Be("Hudson")
throws the well-descriptive message anyway.