コード例 #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)
                      );
            }
                );
        }
コード例 #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)
                    );
                }
            );
        }