Пример #1
0
        public static void WhereAny1()
        {
            bool         notCalled = true;
            Func <bool?> fun       = () => { notCalled = false; return(true); };
            var          q         = Enumerable.Repeat(fun, 1).WhereAny(f => f());

            Assert.True(notCalled);
            Assert.CalledOnNext(q, ref notCalled);
        }
Пример #2
0
        public static void WhereAny1a()
        {
            bool notCalled = true;
            Func <Either <bool, int> > fun = () => { notCalled = false; return(Either <bool, int> .OfLeft(true)); };
            var q = Enumerable.Repeat(fun, 1).WhereAny(f => f());

            Assert.True(notCalled);
            Assert.CalledOnNext(q, ref notCalled);
        }
Пример #3
0
        public static void SelectAny1b()
        {
            bool          notCalled = true;
            Func <string> fun       = () => { notCalled = false; return(String.Empty); };
            var           q         = Enumerable.Repeat(fun, 1).SelectAny(f => f());

            Assert.True(notCalled);
            Assert.CalledOnNext(q, ref notCalled);
        }
Пример #4
0
        public static void Map1a()
        {
            bool notCalled = true;
            Func <Either <int, int> > fun = () => { notCalled = false; return(Either <int, int> .OfLeft(1)); };
            var q = Either.Map(Enumerable.Repeat(fun, 1), f => f());

            Assert.True(notCalled);
            q.OnLeft(x => Assert.CalledOnNext(x, ref notCalled));
            q.OnRight(x => Assert.Fail());
        }
        public static void WhereImpl1a()
        {
            bool notCalled = true;
            Func <Either <bool, int> > fun
                = () => { notCalled = false; return(Either <bool, int> .OfLeft(true)); };
            var q = Enumerable.Repeat(fun, 1).WhereImpl(f => f());

            Assert.True(notCalled);
            q.OnLeft(x => Assert.CalledOnNext(x, ref notCalled));
            q.OnRight(x => Assert.Fail());
        }