public void AndThen() { Result <int, Exception> res1 = new Ok <int, Exception>(1); Assert.Equal("2", res1.AndThen(x => new Ok <string, Exception>($"{x + 1}")).Unwrap()); Assert.Equal(typeof(Err <string, Exception>), res1.AndThen(x => new Err <string, Exception>(new Exception("this is test."))).GetType()); Result <int, Exception> res2 = new Err <int, Exception>(new Exception("this is test.")); Assert.Equal(typeof(Err <string, Exception>), res2.AndThen(x => new Ok <string, Exception>($"{x + 1}")).GetType()); }