diff --git a/src/SolidStack.Core.Flow.Tests/ResultTests.cs b/src/SolidStack.Core.Flow.Tests/ResultTests.cs index 8cbd541..ee70fe7 100644 --- a/src/SolidStack.Core.Flow.Tests/ResultTests.cs +++ b/src/SolidStack.Core.Flow.Tests/ResultTests.cs @@ -168,7 +168,15 @@ public void MapTo_OnError_ReturnsMappedResult() { var result = Result.Error("error"); - var mappedResult = + var mappedResultA = + result + .WhenError() + .MapTo(x => 1) + .WhenSuccess() + .MapTo(x => 0) + .Map(); + + var mappedResultB = result .WhenError() .MapTo(x => 2) @@ -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] @@ -222,7 +240,7 @@ public void MapTo_OnSuccess_ReturnsMappedResult() { var result = Result.Success("success"); - var mappedResult = + var mappedResultA = result .WhenSuccess() .MapTo(x => 0) @@ -230,7 +248,16 @@ public void MapTo_OnSuccess_ReturnsMappedResult() .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] diff --git a/src/SolidStack.Core.Flow/Internal/Result/UnresolvedMappableError.cs b/src/SolidStack.Core.Flow/Internal/Result/UnresolvedMappableError.cs index 9313212..499597b 100644 --- a/src/SolidStack.Core.Flow/Internal/Result/UnresolvedMappableError.cs +++ b/src/SolidStack.Core.Flow/Internal/Result/UnresolvedMappableError.cs @@ -3,7 +3,7 @@ namespace SolidStack.Core.Flow.Internal.Result { internal class UnresolvedMappableError : MappableContent< - ResolvedMappableSuccess, TSuccess, TMappingDestination>, + UnresolvedMappableError, TSuccess, TMappingDestination>, IMappableError { public UnresolvedMappableError(TSuccess content) : diff --git a/src/SolidStack.Core.Flow/SolidStack.Core.Flow.nuspec b/src/SolidStack.Core.Flow/SolidStack.Core.Flow.nuspec index dbbd23f..aa2ab65 100644 --- a/src/SolidStack.Core.Flow/SolidStack.Core.Flow.nuspec +++ b/src/SolidStack.Core.Flow/SolidStack.Core.Flow.nuspec @@ -3,7 +3,7 @@ SolidStack.Core.Flow $version$ - 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. + 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. $authors$ $title$ $projectUrl$ @@ -13,6 +13,9 @@ $copyright$ SolidStack Flow OptionPattern ResultPattern EitherPattern RailwayOrientedProgramming FunctionalProgramming + + +