示例#1
0
        public void TestRangeMethods()
        {
            _list = new List <string>();

            var collection = new NotifyingCollection <string>(false, false);

            collection.CollectionChanged += OnCollectionChanged;

            CompareCollections(_list, collection);

            collection.AddRange(new[] { "a", "b", "c" });
            Assert.AreEqual(3, collection.Count);
            Assert.AreEqual("a", collection[0]);
            Assert.AreEqual("b", collection[1]);
            Assert.AreEqual("c", collection[2]);
            CompareCollections(_list, collection);

            collection.AddRange(new[] { "d", "e" });
            Assert.AreEqual(5, collection.Count);
            Assert.AreEqual("d", collection[3]);
            Assert.AreEqual("e", collection[4]);
            CompareCollections(_list, collection);

            collection.InsertRange(0, new string[0]);
            Assert.AreEqual(5, collection.Count);
            CompareCollections(_list, collection);

            collection.InsertRange(1, new[] { "i" });
            Assert.AreEqual(6, collection.Count);
            Assert.AreEqual("i", collection[1]);
            CompareCollections(_list, collection);

            collection.RemoveRange(2, 4);
            Assert.AreEqual(2, collection.Count);
            CompareCollections(_list, collection);
        }
        public void TestRangeMethods()
        {
            _list = new List<string>();

              var collection = new NotifyingCollection<string>(false, false);
              collection.CollectionChanged += OnCollectionChanged;

              CompareCollections(_list, collection);

              collection.AddRange(new[] { "a", "b", "c" });
              Assert.AreEqual(3, collection.Count);
              Assert.AreEqual("a", collection[0]);
              Assert.AreEqual("b", collection[1]);
              Assert.AreEqual("c", collection[2]);
              CompareCollections(_list, collection);

              collection.AddRange(new[] { "d", "e" });
              Assert.AreEqual(5, collection.Count);
              Assert.AreEqual("d", collection[3]);
              Assert.AreEqual("e", collection[4]);
              CompareCollections(_list, collection);

              collection.InsertRange(0, new string[0]);
              Assert.AreEqual(5, collection.Count);
              CompareCollections(_list, collection);

              collection.InsertRange(1, new[] { "i" });
              Assert.AreEqual(6, collection.Count);
              Assert.AreEqual("i", collection[1]);
              CompareCollections(_list, collection);

              collection.RemoveRange(2, 4);
              Assert.AreEqual(2, collection.Count);
              CompareCollections(_list, collection);
        }
 public void RemoveRangeWithEmptyRange()
 {
     var collection = new NotifyingCollection<string>();
       collection.RemoveRange(0, 0);
 }
 public void RemoveRangeShouldThrowWhenInvalidRange()
 {
     var collection = new NotifyingCollection<string>();
       collection.RemoveRange(0, 1);
 }
 public void RemoveRangeShouldThrowWhenIndexIsWrong()
 {
     var collection = new NotifyingCollection<string>();
       collection.RemoveRange(-1, 0);
 }
 public void RemoveRangeShouldThrowWhenCountIsWrong2()
 {
     var collection = new NotifyingCollection<string>();
       collection.RemoveRange(0, -1);
 }
示例#7
0
        public void RemoveRangeShouldThrowWhenIndexIsWrong()
        {
            var collection = new NotifyingCollection <string>();

            collection.RemoveRange(-1, 0);
        }
示例#8
0
        public void RemoveRangeShouldThrowWhenInvalidRange()
        {
            var collection = new NotifyingCollection <string>();

            collection.RemoveRange(0, 1);
        }
示例#9
0
        public void RemoveRangeWithEmptyRange()
        {
            var collection = new NotifyingCollection <string>();

            collection.RemoveRange(0, 0);
        }
示例#10
0
        public void RemoveRangeShouldThrowWhenCountIsWrong2()
        {
            var collection = new NotifyingCollection <string>();

            collection.RemoveRange(0, -1);
        }