public void DuplicateNullValues() { // Duplicate null values should be allowed, even if allowDuplicates is false. SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<string>(true, false); collection.Add(null); collection.Add(null); }
public void TestDuplicateElements() { SynchronizedNotifyingCollection <string> collection = new SynchronizedNotifyingCollection <string>(true, false); collection.Add("a"); collection.Add(collection[0]); }
public void Test1() { _list = new List <string>(); SynchronizedNotifyingCollection <string> collection = new SynchronizedNotifyingCollection <string>(false, false); collection.CollectionChanged += OnCollectionChanged; CompareCollections(_list, collection); collection.Add("a"); Assert.AreEqual(1, collection.Count); CompareCollections(_list, collection); collection.Add("b"); collection.Add("c"); Assert.AreEqual(3, collection.Count); CompareCollections(_list, collection); collection[1] = "d"; Assert.AreEqual(3, collection.Count); CompareCollections(_list, collection); collection[1] = collection[1]; Assert.AreEqual(3, collection.Count); CompareCollections(_list, collection); collection.RemoveAt(0); Assert.AreEqual(2, collection.Count); CompareCollections(_list, collection); collection.Clear(); CompareCollections(_list, collection); Assert.AreEqual(0, collection.Count); }
public void DuplicateNullValues() { // Duplicate null values should be allowed, even if allowDuplicates is false. SynchronizedNotifyingCollection <string> collection = new SynchronizedNotifyingCollection <string>(true, false); collection.Add(null); collection.Add(null); }
public void TestNullElements() { SynchronizedNotifyingCollection <string> collection = new SynchronizedNotifyingCollection <string>(false, true); collection.Add(null); // Duplicate null values should be allowed, even if AllowDuplicates is false. collection.Add(null); }
public void TestAllowedNullsAndDuplicates() { SynchronizedNotifyingCollection <string> collection = new SynchronizedNotifyingCollection <string>(true, true); collection.Add(null); collection.Add("a"); collection.Add(collection[1]); Assert.AreEqual(3, collection.Count); }
public void TestDuplicateElements4() { SynchronizedNotifyingCollection <string> collection = new SynchronizedNotifyingCollection <string>(true, false); collection.Add("a"); collection.Add("b"); Assert.That(() => collection[1] = "a", Throws.ArgumentException); // But replacing the same item should work! collection[0] = "a"; }
public void GetEnumerator() { SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<string>(true, false); collection.Add("a"); collection.Add("b"); var enumerator = collection.GetEnumerator(); enumerator.MoveNext(); Assert.AreEqual("a", enumerator.Current); enumerator.MoveNext(); Assert.AreEqual("b", enumerator.Current); }
public void GetEnumerator() { SynchronizedNotifyingCollection <string> collection = new SynchronizedNotifyingCollection <string>(true, false); collection.Add("a"); collection.Add("b"); var enumerator = collection.GetEnumerator(); enumerator.MoveNext(); Assert.AreEqual("a", enumerator.Current); enumerator.MoveNext(); Assert.AreEqual("b", enumerator.Current); }
public void MoveThrowsArgumentOutOfRangeException() { var c = new SynchronizedNotifyingCollection <int>(); c.Add(1); c.Add(2); c.Add(3); c.Add(4); c.Add(5); Assert.Throws <ArgumentOutOfRangeException>(() => c.Move(-1, 1)); Assert.Throws <ArgumentOutOfRangeException>(() => c.Move(5, 1)); Assert.Throws <ArgumentOutOfRangeException>(() => c.Move(1, -1)); Assert.Throws <ArgumentOutOfRangeException>(() => c.Move(-1, 5)); }
public void TestNullElements3() { SynchronizedNotifyingCollection <string> collection = new SynchronizedNotifyingCollection <string>(false, true); collection.Add("a"); collection[0] = null; }
public void MoveTest() { var c = new SynchronizedNotifyingCollection<int>(); c.Add(1); c.Add(2); c.Add(3); c.Add(4); c.Add(5); c.CollectionChanged += OnMove; c.Move(0, 0); // Ok, does nothing. c.Move(1, 4); Assert.AreEqual(1, c[0]); Assert.AreEqual(3, c[1]); Assert.AreEqual(4, c[2]); Assert.AreEqual(5, c[3]); Assert.AreEqual(2, c[4]); Assert.AreEqual(5, c.Count); }
public void MoveTest() { var c = new SynchronizedNotifyingCollection <int>(); c.Add(1); c.Add(2); c.Add(3); c.Add(4); c.Add(5); c.CollectionChanged += OnMove; c.Move(0, 0); // Ok, does nothing. c.Move(1, 4); Assert.AreEqual(1, c[0]); Assert.AreEqual(3, c[1]); Assert.AreEqual(4, c[2]); Assert.AreEqual(5, c[3]); Assert.AreEqual(2, c[4]); Assert.AreEqual(5, c.Count); }
public void TestNullElements3() { SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<string>(false, true); collection.Add("a"); collection[0] = null; }
public void TestNullElements() { SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<string>(false, true); collection.Add(null); // Duplicate null values should be allowed, even if AllowDuplicates is false. collection.Add(null); }
public void TestDuplicateElements4() { SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<string>(true, false); collection.Add("a"); collection.Add("b"); Assert.That(() => collection[1] = "a", Throws.ArgumentException); // But replacing the same item should work! collection[0] = "a"; }
public void TestDuplicateElements3() { SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<string>(true, false); collection.Add("a"); collection.Add("b"); collection[0] = collection[1]; }
public void TestDuplicateElements2() { SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<string>(true, false); collection.Add("a"); collection.Add("b"); collection.Insert(1, collection[0]); }
public void TestAllowedNullsAndDuplicates() { SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<string>(true, true); collection.Add(null); collection.Add("a"); collection.Add(collection[1]); Assert.AreEqual(3, collection.Count); }
public void MoveThrowsArgumentOutOfRangeException() { var c = new SynchronizedNotifyingCollection<int>(); c.Add(1); c.Add(2); c.Add(3); c.Add(4); c.Add(5); Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(-1, 1)); Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(5, 1)); Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(1, -1)); Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(-1, 5)); }
public void Test1() { _list = new List<string>(); SynchronizedNotifyingCollection<string> collection = new SynchronizedNotifyingCollection<string>(false, false); collection.CollectionChanged += OnCollectionChanged; CompareCollections(_list, collection); collection.Add("a"); Assert.AreEqual(1, collection.Count); CompareCollections(_list, collection); collection.Add("b"); collection.Add("c"); Assert.AreEqual(3, collection.Count); CompareCollections(_list, collection); collection[1] = "d"; Assert.AreEqual(3, collection.Count); CompareCollections(_list, collection); collection[1] = collection[1]; Assert.AreEqual(3, collection.Count); CompareCollections(_list, collection); collection.RemoveAt(0); Assert.AreEqual(2, collection.Count); CompareCollections(_list, collection); collection.Clear(); CompareCollections(_list, collection); Assert.AreEqual(0, collection.Count); }