-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Extension): Result supports Nullable Value and Error
- Loading branch information
1 parent
745ea77
commit 8243938
Showing
3 changed files
with
42 additions
and
2 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
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,31 @@ | ||
namespace Bogoware.Monads.UnitTests.ResultTests; | ||
|
||
public class ResultValueTests | ||
{ | ||
[Fact] | ||
public void Success_returns_itsValue_andNullError() | ||
{ | ||
var sut = Result.Success(new Value(666)); | ||
|
||
sut.Value.Should().NotBeNull(); | ||
sut.Error.Should().BeNull(); | ||
} | ||
|
||
[Fact] | ||
public void Failure_returns_nullValue_andItsError() | ||
{ | ||
var sut = Result.Failure<Value>("Error"); | ||
|
||
sut.Value.Should().BeNull(); | ||
sut.Error.Should().NotBeNull(); | ||
} | ||
|
||
[Fact] | ||
public void Failure_returns_defaultValue_andItsError() | ||
{ | ||
var sut = Result.Failure<Guid>("Error"); | ||
|
||
sut.Value.Should().Be(default(Guid)); | ||
sut.Error.Should().NotBeNull(); | ||
} | ||
} |