Skip to content

Commit dd000f5

Browse files
author
Maxime Gélinas
committed
Merge branch 'develop'
2 parents 249013d + f4f05a3 commit dd000f5

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

src/SolidStack.Core.Flow.Tests/ResultTests.cs

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,15 @@ public void MapTo_OnError_ReturnsMappedResult()
168168
{
169169
var result = Result<object, object>.Error("error");
170170

171-
var mappedResult =
171+
var mappedResultA =
172+
result
173+
.WhenError()
174+
.MapTo(x => 1)
175+
.WhenSuccess()
176+
.MapTo(x => 0)
177+
.Map();
178+
179+
var mappedResultB =
172180
result
173181
.WhenError<int>()
174182
.MapTo(x => 2)
@@ -178,7 +186,17 @@ public void MapTo_OnError_ReturnsMappedResult()
178186
.MapTo(x => 0)
179187
.Map();
180188

181-
mappedResult.Should().Be(1);
189+
var mappedResultC =
190+
result
191+
.WhenSuccess()
192+
.MapTo(x => 0)
193+
.WhenError()
194+
.MapTo(x => 1)
195+
.Map();
196+
197+
mappedResultA.Should().Be(1);
198+
mappedResultB.Should().Be(1);
199+
mappedResultC.Should().Be(1);
182200
}
183201

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

225-
var mappedResult =
243+
var mappedResultA =
226244
result
227245
.WhenSuccess()
228246
.MapTo(x => 0)
229247
.WhenError()
230248
.MapTo(x => 1)
231249
.Map();
232250

233-
mappedResult.Should().Be(0);
251+
var mappedResultB =
252+
result
253+
.WhenError()
254+
.MapTo(x => 1)
255+
.WhenSuccess()
256+
.MapTo(x => 0)
257+
.Map();
258+
259+
mappedResultA.Should().Be(0);
260+
mappedResultB.Should().Be(0);
234261
}
235262

236263
[Fact]

src/SolidStack.Core.Flow/Internal/Result/UnresolvedMappableError.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace SolidStack.Core.Flow.Internal.Result
44
{
55
internal class UnresolvedMappableError<TError, TSuccess, TMappingDestination> : MappableContent<
6-
ResolvedMappableSuccess<TError, TSuccess, TMappingDestination>, TSuccess, TMappingDestination>,
6+
UnresolvedMappableError<TError, TSuccess, TMappingDestination>, TSuccess, TMappingDestination>,
77
IMappableError<TError, TSuccess, TMappingDestination>
88
{
99
public UnresolvedMappableError(TSuccess content) :

src/SolidStack.Core.Flow/SolidStack.Core.Flow.nuspec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata>
44
<id>SolidStack.Core.Flow</id>
55
<version>$version$</version>
6-
<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>
6+
<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>
77
<authors>$authors$</authors>
88
<title>$title$</title>
99
<projectUrl>$projectUrl$</projectUrl>
@@ -13,6 +13,9 @@
1313
<!--<releaseNotes>$releaseNotes$</releaseNotes>-->
1414
<copyright>$copyright$</copyright>
1515
<tags>SolidStack Flow OptionPattern ResultPattern EitherPattern RailwayOrientedProgramming FunctionalProgramming</tags>
16+
<dependencies>
17+
<dependency id="SolidStack.Core.Flow"/>
18+
</dependencies>
1619
</metadata>
1720
<files>
1821
<file src="bin\$configuration$\netstandard2.0\SolidStack.Core.Flow.dll" target="lib\netstandard2.0"/>

0 commit comments

Comments
 (0)