예제 #1
0
 public void Exc_SelectMany_Explicit()
 {
     UnitTest(
         _ => Exc.Success <string, Exception>("Harun"),
         e =>
     {
         return
         (from s in e
          from f in Exc.Failure <string, Exception>(new Exception().ToEnumerableException(s))
          let ex = s.Split("a").First()
                   select Exc.Success <string, Exception>(ex));
     },
         r =>
     {
         Assert.True(r.IsFailure);
         Assert.Equal("Harun", r.Failure.UnsafeGet().Message);
     }
         );
 }
예제 #2
0
 public void Exc_SelectMany()
 {
     UnitTest(
         _ => Exc.Success <string, Exception>("Harun"),
         e =>
     {
         return
         (from s in e
          from f in Exc.Success <string, Exception>($"{s} Cerim")
          where f.SafeNotEquals("Harun")
          select f);
     },
         r =>
     {
         Assert.True(r.IsSuccess);
         Assert.Equal("Harun Cerim", r.Success.UnsafeGet());
     }
         );
 }