public void RemoveAt_OfAnInstanceInitializedWithReadOnlyList_ThrowsException() { // Arrange var c0 = new NonNullCollection <IUnit>(new IUnit[] { MutableUnit.Create("foo"), MutableUnit.Create("bar") }.ToList().AsReadOnly()); // Act // Assert Assert.That(() => { c0.RemoveAt(1); }, Throws.InstanceOf <NotSupportedException>()); }
public void RemoveAt_OfAnInstanceInitializedWithNormalList_DoesNotThrowException() { // Arrange var c0 = new NonNullCollection <IUnit>(new IUnit[] { MutableUnit.Create("foo"), MutableUnit.Create("bar") }.ToList()); // Act c0.RemoveAt(1); // Assert Assert.That(c0.Count, Is.EqualTo(1)); }
public void ctor_WhenArgumentContainsNull_ThrowsException() { // Arrange // Act // Assert Assert.That(() => new NonNullCollection <IUnit>(new IUnit[] { MutableUnit.Create("foo"), null, MutableUnit.Create("bar") }), Throws.ArgumentException); Assert.That(() => new NonNullCollection <IUnit>(new IUnit[] { null, MutableUnit.Create("foo"), MutableUnit.Create("bar") }), Throws.ArgumentException); Assert.That(() => new NonNullCollection <IUnit>(new IUnit[] { MutableUnit.Create("foo"), MutableUnit.Create("bar"), null }), Throws.ArgumentException); }