public void RemoveAll_OfAnInstanceInitializedWithNormalList_DoesNotThrowException() { // Arrange var c0 = new NonNullCollection <IUnit>(new IUnit[] { MutableUnit.Create("foo"), MutableUnit.Create("bar") }.ToList()); // Act c0.RemoveAll(x => x.Name == "bar"); c0.RemoveAll("g"); // Assert Assert.That(c0.Count, Is.EqualTo(0)); }
public void RemoveAll_OfAnInstanceInitializedWithReadOnlyList_ThrowsException() { // Arrange var c0 = new NonNullCollection <IUnit>(new IUnit[] { MutableUnit.Create("foo"), MutableUnit.Create("bar") }.ToList().AsReadOnly()); // Act // Assert Assert.That(() => { c0.RemoveAll("g"); }, Throws.InstanceOf <NotSupportedException>()); Assert.That(() => { c0.RemoveAll(x => x.Name == "foo"); }, Throws.InstanceOf <NotSupportedException>()); }