public void Given_BothIor_Then_Map_Should_Return_A_New_BothIor_With_Same_Left_Value() { var value = 100; var defaultValue = -1; Ior.Both(value, value).Map(i => i * 2).Left.GetOrElse(defaultValue).Should().Be(value); }
public void Given_BothIor_Then_Map_Should_Return_A_New_BothIor_With_Transformed_Right_Value() { var value = 100; var transformedValue = value * 2; var defaultValue = -1; Ior.Both(value, value).Map(i => i * 2).Right.GetOrElse(defaultValue).Should().Be(transformedValue); }
public void Given_Both_Ior_Then_ToEither_Should_Return_A_Right_Either_With_The_Right_Value() { var lvalue = 100; var rvalue = 200; var defaultValue = -1; Ior.Both(lvalue, rvalue).ToEither().Right.GetOrElse(defaultValue).Should().Be(rvalue); }
public void Given_Both_Ior_Then_ToLeftOption_Should_Return_A_Some_With_The_Left_Value() { var defaultValue = -1; var lvalue = 100; var rvalue = 200; Ior.Both(lvalue, rvalue).ToLeftOption().GetOrElse(defaultValue).Should().Be(lvalue); }
public void Given_Both_Ior_Then_Deconstruct_Should_Return_A_Some_With_Right_Value_In_First_Position() { var lvalue = 100; var rvalue = 200; var defaultValue = -1; var ior = Ior.Both(lvalue, rvalue); var(_, right) = ior; right.GetOrElse(defaultValue).Should().Be(rvalue); }
public void Given_BothIor_Then_MapLeft_Should_Return_A_New_BothIor() { Ior.Both(100, 100).MapLeft(i => i * 2).IsBoth.Should().BeTrue(); }
public void Given_Both_Ior_Then_ToEither_Should_Return_A_Right_Either() { Ior.Both(100, 200).ToEither().IsRight.Should().BeTrue(); }
public void Given_BothIor_Then_Bimap_Should_Return_A_New_BothIor() { Ior.Both(100, 100).Bimap(i => i * 2, i => i * 4).IsBoth.Should().BeTrue(); }