Ejemplo n.º 1
0
        public void CopyTo()
        {
            var cut          = new SortedBindingList <Data>();
            var raisedEvents = new List <ListChangedEventArgs>();

            cut.ListChanged += (s, e) => raisedEvents.Add(e);

            var datas  = AddData(cut, 10);
            var result = new Data[datas.Length];

            cut.CopyTo(result);

            Assert.AreEqual(datas.Length, result.Length);
            for (var i = 0; i < datas.Length; i++)
            {
                Assert.AreEqual(datas[i], result[i]);
            }
        }
Ejemplo n.º 2
0
        public void CopyTo()
        {
            int[] intArray = { 5, 7, 1, 3, 5, 44, 32 };
            SortedBindingList <int> sortedList = new SortedBindingList <int>(intArray);

            int[] intArray2 = { 3, 75, 1222, 3333, 511, 443, 332 };

            Assert.AreEqual(1222, intArray2[2]);

            sortedList.ApplySort("", ListSortDirection.Descending);
            Assert.AreEqual(44, sortedList[0], "Sorted values incorrect");

            sortedList.CopyTo(intArray2, 0);

            Assert.AreEqual(44, intArray2[0], "Copied values incorrect");
            Assert.AreEqual(7, intArray2[2], "Copied values incorrect");

            foreach (int item in intArray2)
            {
                Console.WriteLine(item.ToString());
            }
        }
Ejemplo n.º 3
0
        public void CopyTo()
        {
            int[] intArray = { 5, 7, 1, 3, 5, 44, 32 };
            SortedBindingList<int> sortedList = new SortedBindingList<int>(intArray);

            int[] intArray2 = { 3, 75, 1222, 3333, 511, 443, 332 };

            Assert.AreEqual(1222, intArray2[2]);

            sortedList.ApplySort("", ListSortDirection.Descending);
            Assert.AreEqual(44, sortedList[0], "Sorted values incorrect");

            sortedList.CopyTo(intArray2, 0);

            Assert.AreEqual(44, intArray2[0], "Copied values incorrect");
            Assert.AreEqual(7, intArray2[2], "Copied values incorrect");

            foreach (int item in intArray2)
            {
                Console.WriteLine(item.ToString());
            }
        }