예제 #1
0
        public void MatchRight_correctly_returns_none_when_left_is_defined()
        {
            var either = new LeftOrRight(new Left("Samwise"));
            var result = either.MatchRight(x => x.Number);

            Assert.Equal(Optional.None <int>(), result);
        }
예제 #2
0
        public void MatchOptional_correctly_applies_logic_to_right()
        {
            var either = new LeftOrRight(new Right(4));
            var result = either.MatchRight(x => x.Number * 2);

            Assert.Equal(Optional.Create <int>(8), result);
        }