Exemple #1
0
        public void Given_RightIor_Then_MapLeft_Should_Return_A_New_RightIor_With_Same_Value()
        {
            var value        = 100;
            var defaultValue = -1;

            Ior.Right <int, int>(value).MapLeft(i => i * 2).Right.GetOrElse(defaultValue).Should().Be(value);
        }
Exemple #2
0
        public void Given_Right_Ior_Then_ToEither_Should_Return_A_Right_Either_With_The_Value()
        {
            var value        = 100;
            var defaultValue = -1;

            Ior.Right <int, int>(value).ToEither().Right.GetOrElse(defaultValue).Should().Be(value);
        }
Exemple #3
0
        public void Given_Right_Ior_Then_ToOption_Should_Return_A_Some_With_The_Value()
        {
            var defaultValue = -1;
            var value        = 100;

            Ior.Right <int, int>(value).ToOption().GetOrElse(defaultValue).Should().Be(value);
        }
Exemple #4
0
        public void Given_RightIor_Then_Map_Should_Return_A_New_RightIor_With_Transformed_Value()
        {
            var value            = 100;
            var transformedValue = value * 2;
            var defaultValue     = -1;

            Ior.Right <int, int>(value).Map(i => i * 2).Right.GetOrElse(defaultValue).Should().Be(transformedValue);
        }
Exemple #5
0
        public void Given_Right_Ior_Then_Deconstruct_Should_Return_A_Some_With_Right_Value_In_Second_Position()
        {
            var value        = 100;
            var defaultValue = -1;
            var ior          = Ior.Right <int, int>(value);

            var(_, right) = ior;
            right.GetOrElse(defaultValue).Should().Be(value);
        }
Exemple #6
0
        public void Given_Right_Ior_Then_Deconstruct_Should_Return_A_None_In_First_Position()
        {
            var value        = 100;
            var defaultValue = -1;
            var ior          = Ior.Right <int, int>(value);

            var(left, _) = ior;
            left.GetOrElse(defaultValue).Should().Be(defaultValue);
        }
Exemple #7
0
 public void Given_RightIor_Then_MapLeft_Should_Return_A_New_RightIor()
 {
     Ior.Right <int, int>(100).MapLeft(i => i * 2).IsRight.Should().BeTrue();
 }
Exemple #8
0
 public void Given_Right_Ior_Then_ToEither_Should_Return_A_Right_Either()
 {
     Ior.Right <int, int>(100).ToEither().IsRight.Should().BeTrue();
 }
Exemple #9
0
 public void Given_Right_Ior_Then_ToLeftOption_Should_Return_A_None()
 {
     Ior.Right <int, int>(100).ToLeftOption().IsNone.Should().BeTrue();
 }
Exemple #10
0
 public void Given_RightIor_Then_Bimap_Should_Return_A_New_RightIor()
 {
     Ior.Right <int, int>(100).Bimap(i => i * 2, i => i * 4).IsRight.Should().BeTrue();
 }