Exemplo n.º 1
0
        public void TestRangeMethods()
        {
            _list = new List <string>();

            SynchronizedNotifyingCollection <string> collection = new SynchronizedNotifyingCollection <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);
        }
 public void AddRangeShouldThrowWhenNull()
 {
     SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<string>();
       collection.AddRange(null);
 }
        public void TestRangeMethods()
        {
            _list = new List<string>();

              SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<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);
        }
Exemplo n.º 4
0
        public void AddRangeShouldThrowWhenNull()
        {
            SynchronizedNotifyingCollection <string> collection = new SynchronizedNotifyingCollection <string>();

            collection.AddRange(null);
        }