public void AddRangeToSecond_Always_RaisesNotifyCollectionChangedWithRemoveActionAndCorrectValuesForEachItemRemoved() { var continuousSecondCollection = new ContinuousCollection <Person>(); _target = new ExceptReadOnlyContinuousCollection <Person>(_first, continuousSecondCollection); var eventArgsList = TestUtilities.GetCollectionChangedEventArgsList(_target); continuousSecondCollection.AddRange(_first); Assert.AreEqual(2, eventArgsList.Count); TestUtilities.AssertRemove(eventArgsList[0], 0, _person1); TestUtilities.AssertRemove(eventArgsList[1], 0, _person2); }
public void AddRangeToSecond_Always_RaisesNotifyCollectionChangedWithAddActionAndCorrectValues() { var continuousSecondCollection = new ContinuousCollection <Person>(); _target = new ConcatReadOnlyContinuousCollection <Person>(_first, continuousSecondCollection); var people = new List <Person> { new Person(), new Person() }; var eventArgsList = TestUtilities.GetCollectionChangedEventArgsList(_target); continuousSecondCollection.AddRange(people); Assert.AreEqual(1, eventArgsList.Count); TestUtilities.AssertAdd(eventArgsList[0], 2, people.ToArray()); }
public void AddRange_Always_CallsNotifyCollectionChangedOnlyOnce() { int timesCalled = 0; _target.CollectionChanged += (sender, e) => timesCalled++; IEnumerable <Person> people = GetPeople(); _target.AddRange(people); Assert.AreEqual(1, timesCalled); }
public void AddRangeToSecond_Always_RaisesNotifyCollectionChangedWithRemoveActionAndCorrectValuesForEachItemRemoved() { var continuousSecondCollection = new ContinuousCollection<Person>(); _target = new ExceptReadOnlyContinuousCollection<Person>(_first, continuousSecondCollection); var eventArgsList = TestUtilities.GetCollectionChangedEventArgsList(_target); continuousSecondCollection.AddRange(_first); Assert.AreEqual(2, eventArgsList.Count); TestUtilities.AssertRemove(eventArgsList[0], 0, _person1); TestUtilities.AssertRemove(eventArgsList[1], 0, _person2); }
public void AddRangeToFirst_Always_RaisesNotifyCollectionChangedWithAddActionAndCorrectValues() { var continuousFirstCollection = new ContinuousCollection<Person>(_first.ToList()); _target = new ExceptReadOnlyContinuousCollection<Person>(continuousFirstCollection, _second); var people = new List<Person> { new Person(), new Person() }; var eventArgsList = TestUtilities.GetCollectionChangedEventArgsList(_target); continuousFirstCollection.AddRange(people); Assert.AreEqual(1, eventArgsList.Count); TestUtilities.AssertAdd(eventArgsList[0], 2, people.ToArray()); }