Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Gélinas committed Jun 15, 2018
2 parents 249013d + f4f05a3 commit dd000f5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
35 changes: 31 additions & 4 deletions src/SolidStack.Core.Flow.Tests/ResultTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,15 @@ public void MapTo_OnError_ReturnsMappedResult()
{
var result = Result<object, object>.Error("error");

var mappedResult =
var mappedResultA =
result
.WhenError()
.MapTo(x => 1)
.WhenSuccess()
.MapTo(x => 0)
.Map();

var mappedResultB =
result
.WhenError<int>()
.MapTo(x => 2)
Expand All @@ -178,7 +186,17 @@ public void MapTo_OnError_ReturnsMappedResult()
.MapTo(x => 0)
.Map();

mappedResult.Should().Be(1);
var mappedResultC =
result
.WhenSuccess()
.MapTo(x => 0)
.WhenError()
.MapTo(x => 1)
.Map();

mappedResultA.Should().Be(1);
mappedResultB.Should().Be(1);
mappedResultC.Should().Be(1);
}

[Fact]
Expand Down Expand Up @@ -222,15 +240,24 @@ public void MapTo_OnSuccess_ReturnsMappedResult()
{
var result = Result<string, string>.Success("success");

var mappedResult =
var mappedResultA =
result
.WhenSuccess()
.MapTo(x => 0)
.WhenError()
.MapTo(x => 1)
.Map();

mappedResult.Should().Be(0);
var mappedResultB =
result
.WhenError()
.MapTo(x => 1)
.WhenSuccess()
.MapTo(x => 0)
.Map();

mappedResultA.Should().Be(0);
mappedResultB.Should().Be(0);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SolidStack.Core.Flow.Internal.Result
{
internal class UnresolvedMappableError<TError, TSuccess, TMappingDestination> : MappableContent<
ResolvedMappableSuccess<TError, TSuccess, TMappingDestination>, TSuccess, TMappingDestination>,
UnresolvedMappableError<TError, TSuccess, TMappingDestination>, TSuccess, TMappingDestination>,
IMappableError<TError, TSuccess, TMappingDestination>
{
public UnresolvedMappableError(TSuccess content) :
Expand Down
5 changes: 4 additions & 1 deletion src/SolidStack.Core.Flow/SolidStack.Core.Flow.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>SolidStack.Core.Flow</id>
<version>$version$</version>
<description>SolidStack.Core.Guards focuses on encapsulating the branching logic of your code so you can write a linear and much more readable code flow without having to deal with exceptions, null checks and unnecessary conditions.</description>
<description>SolidStack.Core.Flow focuses on encapsulating the branching logic of your code so you can write a linear and much more readable code flow without having to deal with exceptions, null checks and unnecessary conditions.</description>
<authors>$authors$</authors>
<title>$title$</title>
<projectUrl>$projectUrl$</projectUrl>
Expand All @@ -13,6 +13,9 @@
<!--<releaseNotes>$releaseNotes$</releaseNotes>-->
<copyright>$copyright$</copyright>
<tags>SolidStack Flow OptionPattern ResultPattern EitherPattern RailwayOrientedProgramming FunctionalProgramming</tags>
<dependencies>
<dependency id="SolidStack.Core.Flow"/>
</dependencies>
</metadata>
<files>
<file src="bin\$configuration$\netstandard2.0\SolidStack.Core.Flow.dll" target="lib\netstandard2.0"/>
Expand Down

0 comments on commit dd000f5

Please sign in to comment.