예제 #1
0
        public void Error_OnError_LeftIsTrue()
        {
            var example = new ThrowMyToys();
            var x       = example.CallName("foo");

            Assert.True(x.IsLeft);
            Assert.False(x.IsRight);
        }
예제 #2
0
        public void Error_OnNoError_ReturnsHaha()
        {
            var example = new ThrowMyToys();
            var x       = example.CallName("BooBoo");

            x.Match(
                Right: s => Assert.Equal("Haha", s),
                Left: err => Assert.True(false)
                );
        }
예제 #3
0
        public void Error_OnError_ReturnsError()
        {
            var example = new ThrowMyToys();
            var x       = example.CallName("foo");

            x.Match(
                Right: s => Assert.True(false),
                Left: err => Assert.IsType <Error>(err)
                );
        }
예제 #4
0
        public void Error_OnNoError_MatchesRight()
        {
            var example = new ThrowMyToys();
            var x       = example.CallName("BooBoo");

            x.Match(
                Right: s => Assert.True(true),
                Left: err => Assert.True(false)
                );
        }
예제 #5
0
        public void Error_OnError_MatchesLeft()
        {
            var example = new ThrowMyToys();
            var x       = example.CallName("foo");

            x.Match(
                Right: s => Assert.True(false),
                Left: err => Assert.True(true)//expecting this one
                );
        }