Exemplo n.º 1
0
        public void LastIndexTest()
        {
            ICollection arr      = GetList();
            int         expected = 3;
            int         actual;

            actual = ICollectionExt.LastIndex(arr);
            EAssert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void ToStringTest()
        {
            ICollection arr       = GetList();
            string      separator = ";";
            string      expected  = "1;2;3;4";
            string      actual;

            actual = arr.ToString(separator);
            EAssert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void EGetRangeTest1()
        {
            IList <int> coll       = GetList();
            int         startIndex = 2;
            List <int>  expected   = new List <int> {
                3, 4
            };
            List <int> actual;

            actual = IListExt.EGetRange <int>(coll, startIndex);
            EAssert.AreEqual(actual, expected);
        }
Exemplo n.º 4
0
        public void RemoveRangeTest()
        {
            ICollection <int> coll  = GetList();
            IEnumerable <int> items = new List <int> {
                1, 3
            };
            IEnumerable <int> expected = new List <int> {
                2, 4
            };

            ICollectionExt.RemoveRange <int>(coll, items);
            EAssert.AreEqual(coll, expected);
        }
Exemplo n.º 5
0
        public void CutTest()
        {
            List <int>       coll      = GetList();
            Func <int, bool> predicate = (int i) => (i > 1);
            List <int>       expected  = new List <int>()
            {
                2, 3, 4
            };
            List <int> actual;

            actual = ICollectionExt.Cut <int>(coll, predicate);
            EAssert.AreEqual(actual, expected);
            EAssert.AreEqual(coll.Count, 1);
        }
Exemplo n.º 6
0
        public void EGetRangeTest()
        {
            IList <int> coll       = GetList();
            int         startIndex = 1;
            int         count      = 2;
            List <int>  expected   = new List <int>()
            {
                2, 3
            };
            List <int> actual;

            actual = IListExt.EGetRange <int>(coll, startIndex, count);
            EAssert.AreEqual(actual, expected);
        }
Exemplo n.º 7
0
        public void SplitByIndexTest()
        {
            IList <int> coll  = GetList();
            int         index = 2;
            bool        excludeSplittingItem = true;

            List <int>[] expected = new List <int>[] { new List <int>()
                                                       {
                                                           1, 2
                                                       }, new List <int>()
                                                       {
                                                           4
                                                       } };
            List <int>[] actual;
            actual = coll.SplitByIndex <int>(index, excludeSplittingItem);

            EAssert.AreEqual(actual, expected);
        }