コード例 #1
0
ファイル: ResultTest.cs プロジェクト: setochi/Rusty
        public void MapErr()
        {
            Result <int, Exception> res1 = new Ok <int, Exception>(1);

            Assert.Equal(1, res1.MapErr(e => e).Unwrap());

            Result <int, Exception> res2 = new Err <int, Exception>(new Exception("this is test."));

            Assert.Equal(typeof(Err <int, string>), res2.MapErr(e => "mapped error.").GetType());
        }