Exemplo n.º 1
0
        public void TestIEnumerator()
        {
            var names = new List<String>() { "marko", "josh", "peter" };

            IPipe<String, String> pipe = new IdentityPipe<String>();
            pipe.SetSourceCollection(names);

            var counter = 0UL;
            while (pipe.MoveNext())
            {
                counter++;
                String name = pipe.Current;
                Assert.IsTrue(name.Equals("marko") || name.Equals("josh") || name.Equals("peter"));
            }

            Assert.AreEqual(counter, 3UL);
            pipe.SetSourceCollection(names);
            counter = 0UL;

            foreach (var name in pipe)
            {
                Assert.IsTrue(name.Equals("marko") || name.Equals("josh") || name.Equals("peter"));
                counter++;
            }

            Assert.AreEqual(counter, 3UL);
        }
Exemplo n.º 2
0
        public void testIdentityPipeZero()
        {

            var _UUIDs = BaseTest.GenerateUUIDs(0);
            var _Pipe  = new IdentityPipe<String>();
            _Pipe.SetSourceCollection(_UUIDs);

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

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

            var _Numbers = new List<Int32>() { 1, 2, 3, 4 };
            var _Pipe    = new IdentityPipe<Int32>();
            _Pipe.SetSourceCollection(_Numbers);

            var _Counter = 0;
            while (_Pipe.MoveNext())
            {
                Assert.AreEqual(_Pipe.Current, _Numbers.ElementAt(_Counter));
                _Counter++;
            }

            Assert.AreEqual(_Counter, 4);

        }
Exemplo n.º 4
0
        public void testIdentityPipeNormal()
        {

            var _UUIDs = BaseTest.GenerateUUIDs(100);
            var _Pipe  = new IdentityPipe<String>();
            _Pipe.SetSourceCollection(_UUIDs);

            var _Counter = 0;
            while (_Pipe.MoveNext())
            {
                Assert.AreEqual(_Pipe.Current, _UUIDs.ElementAt(_Counter));
                _Counter++;
            }

            Assert.AreEqual(_Counter, 100);

        }