-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix issue with a new extension method
- Loading branch information
Showing
5 changed files
with
101 additions
and
48 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
sample/Ardalis.Result.Sample.Core/Services/BadResultService.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,11 @@ | ||
namespace Ardalis.Result.Sample.Core.Services; | ||
|
||
public class BadResultService | ||
{ | ||
public Result ReturnErrorWithMessage(string message) | ||
{ | ||
var result = Result.Error(message); | ||
return result; | ||
} | ||
|
||
} |
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
20 changes: 20 additions & 0 deletions
20
...le/Ardalis.Result.Sample.UnitTests/ServiceTests/BadResultService_ReturnResultWithError.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,20 @@ | ||
using System.Linq; | ||
using Ardalis.Result.Sample.Core.Services; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace Ardalis.Result.Sample.UnitTests.ServiceTests; | ||
|
||
public class BadResultService_ReturnResultWithError | ||
{ | ||
[Fact] | ||
public void ReturnsErrorResultGivenMessage() | ||
{ | ||
var service = new BadResultService(); | ||
|
||
var result = service.ReturnErrorWithMessage("Some error message"); | ||
|
||
result.Status.Should().Be(ResultStatus.Error); | ||
result.Errors.Single().Should().Be("Some error message"); | ||
} | ||
} |
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