Exemplo n.º 1
0
        public void Some()
        {
            Result <int, Exception> res1 = new Ok <int, Exception>(1);

            Assert.Equal(typeof(Some <int>), res1.Some().GetType());
            Assert.Equal(1, res1.Some().Unwrap());

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

            Assert.Equal(typeof(None <int>), res2.Some().GetType());
            Assert.Throws <InvalidOperationException>(() => res2.Some().Unwrap());
        }