public void ShouldMapOverAnOk() { var result = new Ok <int>(34); var newRes = result.Map(i => i + 1); Assert.AreEqual(35, newRes.Value); }
public void Map() { Result <int, Exception> res1 = new Ok <int, Exception>(1); Assert.Equal(2, res1.Map(x => x + 1).Unwrap()); Result <int, Exception> res2 = new Err <int, Exception>(new Exception("this is test.")); Assert.Equal(typeof(Err <string, Exception>), res2.Map(x => $"{x + 1}").GetType()); }