public void ShouldReturnFalseIfItemToUpdateDoesNotExist() { // Arrange TestObject objectToAdd = TestObjectFaker.Create().Generate(); TestObject objectToUpdateWith = TestObjectFaker.Create().Generate(); var list = new List <TestObject> { objectToAdd }; // Act bool updated = list.Update(objectToUpdateWith, (s, i) => s.Name == objectToUpdateWith.Name); // Assert updated.ShouldBeFalse(); }
public void ShouldAddRangeOfItems() { // Arrange List <TestObject> objectsToAdd = TestObjectFaker.Create().Generate(10); var collection = new ObservableCollection <TestObject>(); // Act collection.AddRange(objectsToAdd); // Assert foreach (TestObject item in objectsToAdd) { collection.ShouldContain(item); } }
public void ShouldRemoveRangeOfItems() { // Arrange List <TestObject> items = TestObjectFaker.Create().Generate(10); var itemsToRemove = items.Take(5).ToList(); var collection = new ObservableCollection <TestObject>(items); // Act collection.RemoveRange(itemsToRemove); // Assert foreach (TestObject item in itemsToRemove) { collection.ShouldNotContain(item); } }