예제 #1
0
        public void ShouldMapOverAnOk()
        {
            var result = new Ok <int>(34);
            var newRes = result.Map(i => i + 1);

            Assert.AreEqual(35, newRes.Value);
        }
예제 #2
0
파일: ResultTest.cs 프로젝트: setochi/Rusty
        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());
        }