Exemple #1
0
        public void TestCaseAssumeNull()
        {
            var ocr = new ObservableCollectionRanged <string>();

            ocr.AddRange(names1);

            ocr.CollectionChanged += (sender, e) =>
            {
                Assert.IsTrue(e.Action == NotifyCollectionChangedAction.Reset);
                Assert.IsNull(e.NewItems);
                Assert.IsNull(e.OldItems);
            };

            ocr.AssumeRange(null);
        }
Exemple #2
0
        public void TestCaseAssume()
        {
            var ocr = new ObservableCollectionRanged <string>();

            ocr.AddRange(names1);
            ocr.AddRange(names2);

            ocr.CollectionChanged += (sender, e) =>
            {
                Assert.IsTrue(e.Action == NotifyCollectionChangedAction.Replace);
                Assert.IsNotNull(e.NewItems);
                Assert.IsNotNull(e.OldItems);
                Assert.IsTrue(e.OldItems.Count == (names1.Count + names2.Count));
                Assert.IsTrue(e.NewItems.Count == names1.Count);
            };

            ocr.AssumeRange(names1);
        }
Exemple #3
0
        public void TestCaseAssumeGrouped()
        {
            var ocr = new ObservableCollectionRanged <IGrouping <int, string> >();

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

            ocr.AddRange(groupedList1);

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

            ocr.AddRange(groupedList2);

            ocr.CollectionChanged += (sender, e) =>
            {
                Assert.IsTrue(e.Action == NotifyCollectionChangedAction.Replace);
                Assert.IsNotNull(e.NewItems);
                Assert.IsNotNull(e.OldItems);
                Assert.IsTrue(e.OldItems.Count == (groupedList1.Count() + groupedList2.Count()));
                Assert.IsTrue(e.NewItems.Count == groupedList1.Count());
            };

            ocr.AssumeRange(groupedList1);
        }