Exemplo n.º 1
0
        public void testFuncFilterPipeTrue()
        {

            var _Numbers = Enumerable.Range(1, 10);

            // Even or odd?
            var _Pipe = new FuncFilterPipe<Int32>((_Int32) => true);
            _Pipe.SetSourceCollection(_Numbers);

            var _Counter = 0;
            while (_Pipe.MoveNext())
            {
                _Counter++;
            }

            Assert.AreEqual(_Counter, 0);

        }
Exemplo n.º 2
0
        public void testFuncFilterPipeNormal()
        {

            var _Numbers = Enumerable.Range(1, 10);

            // Even or odd?
            var _Pipe = new FuncFilterPipe<Int32>((_Int32) => ((_Int32 & 0x1) != 0) ? true : false);
            _Pipe.SetSourceCollection(_Numbers);

            var _Counter = 0;
            while (_Pipe.MoveNext())
            {
                Assert.IsTrue((_Pipe.Current & 0x01) == 0);
                _Counter++;
            }

            Assert.AreEqual(_Counter, 5);

        }
Exemplo n.º 3
0
        public void testFuncFilterPipeZero()
        {

            var _Numbers = new List<Int32>();
            var _Pipe    = new FuncFilterPipe<Int32>((_Int32) => false);
            _Pipe.SetSourceCollection(_Numbers);

            var _Counter = 0;
            Assert.IsFalse(_Pipe.Any());
            Assert.AreEqual(_Counter, 0);
            Assert.IsFalse(_Pipe.Any());

        }