Ejemplo n.º 1
0
 public void OrElse()
 {
     Result00.Ok(new T0(0)).OrElse(_ => Result01.Ok(new T0(1))).Should().Be(Result01.Ok(new T0(0)));
     Result00.Ok(new T0(0)).OrElse(_ => Result01.Err(new E1(1))).Should().Be(Result01.Ok(new T0(0)));
     Result00.Err(new E0(0)).OrElse(_ => Result01.Ok(new T0(1))).Should().Be(Result01.Ok(new T0(1)));
     Result00.Err(new E0(0)).OrElse(_ => Result01.Err(new E1(1))).Should().Be(Result01.Err(new E1(1)));
 }
Ejemplo n.º 2
0
 public void OrWorks()
 {
     Result00.Ok(new T0(0)).Or(Result01.Ok(new T0(1))).Should().Be(Result01.Ok(new T0(0)));
     Result00.Ok(new T0(0)).Or(Result01.Err(new E1(1))).Should().Be(Result01.Ok(new T0(0)));
     Result00.Err(new E0(0)).Or(Result01.Ok(new T0(1))).Should().Be(Result01.Ok(new T0(1)));
     Result00.Err(new E0(0)).Or(Result01.Err(new E1(1))).Should().Be(Result01.Err(new E1(1)));
 }