示例#1
0
        public void TestCaseInsert()
        {
            var ocr = new ObservableCollectionRanged <string>();

            int index = 0;

            ocr.AddRange(names1);

            ocr.CollectionChanged += (sender, e) =>
            {
                Assert.IsTrue(e.Action == NotifyCollectionChangedAction.Add);
                Assert.IsNotNull(e.NewItems);
                Assert.IsNull(e.OldItems);
                Assert.IsTrue(e.NewItems.Count == names2.Count);
                Assert.AreEqual(index, e.NewStartingIndex);
            };

            ocr.InsertRange(index, names2);
        }
示例#2
0
        public void TestCaseInsertGrouped()
        {
            var ocr = new ObservableCollectionRanged <IGrouping <int, string> >();

            int index = 0;

            var groupedList1 = names1.GroupBy(s => s.Length);

            ocr.AddRange(groupedList1);

            var groupedList2 = names2.GroupBy(s => s.Length);

            ocr.CollectionChanged += (sender, e) =>
            {
                Assert.IsTrue(e.Action == NotifyCollectionChangedAction.Add);
                Assert.IsNotNull(e.NewItems);
                Assert.IsNull(e.OldItems);
                Assert.IsTrue(e.NewItems.Count == groupedList2.Count());
                Assert.AreEqual(index, e.NewStartingIndex);
            };

            ocr.InsertRange(index, groupedList2);
        }