Exemplo n.º 1
0
        public void AccessUninitialisedEitherMember()
        {
            var obj = new EitherClass();

            match(obj.EitherValue,
                  Right: r => Console.WriteLine(r),
                  Left: l => Console.WriteLine(l)
                  );

            Assert.Throws <BottomException>(
                () => {
                match(obj.EitherOtherValue,
                      Right: r => Console.WriteLine(r),
                      Left: l => Console.WriteLine(l)
                      );
            }
                );
        }
Exemplo n.º 2
0
        public void AccessUninitialisedEitherMember()
        {
            var obj = new EitherClass();

            match(obj.EitherValue,
                Right: r => Console.WriteLine(r),
                Left: l => Console.WriteLine(l)
            );

            Assert.Throws(
                typeof(EitherNotInitialisedException),
                () => {

                    match(obj.EitherOtherValue,
                        Right: r => Console.WriteLine(r),
                        Left: l => Console.WriteLine(l)
                    );
                }
            );
        }