Пример #1
0
        public void Either4_Fold()
        {
            Action a = () => {};
            Either <Action, object, string, Type> e = Either <Action, object, string, Type> .A(a);

            Assert.AreEqual(a, e.Fold(v => v, v => null, v => null, v => null));

            e = Either <Action, object, string, Type> .D(typeof(object));

            Assert.AreEqual(typeof(object), e.Fold(v => null, v => null, v => null, v => v));
        }
Пример #2
0
        public void Either4_Fold_d_Null()
        {
            Func <Action, int> a = x => 42;
            Func <object, int> b = x => Convert.ToInt32(x);
            Func <string, int> c = x => Convert.ToInt32(x);
            Func <Type, int>   d = null;

            var e = Either <Action, object, string, Type> .A(() => {});

            AssertException <ArgumentNullException> (() => e.Fold(a, b, c, d));

            e = Either <Action, object, string, Type> .B(new object());

            AssertException <ArgumentNullException> (() => e.Fold(a, b, c, d));

            e = Either <Action, object, string, Type> .C("foo");

            AssertException <ArgumentNullException> (() => e.Fold(a, b, c, d));

            e = Either <Action, object, string, Type> .D(typeof(object));

            AssertException <ArgumentNullException> (() => e.Fold(a, b, c, d));
        }
Пример #3
0
 protected override Either <Action, object, string, Type> CreateValueZ()
 {
     return(Either <Action, object, string, Type> .D(typeof(string)));
 }
Пример #4
0
 public void Either4_D_ValueNull()
 {
     Either <Action, object, string, Type> .D(null);
 }