public void CheckIfAddedElementsAreLastInCollection() { //Arrange IntDataBase db = new IntDataBase(new List <int>() { 1 }); //Act db.Add(2); db.Add(3); db.Add(4); //Assert CollectionAssert.AreEqual(new int[] { 1, 2, 3, 4 }, db.Elements); }
public void DatabaseAddManyElements() { //Arrange IntDataBase db = new IntDataBase(new List <int>() { 1 }); //Act db.Add(2); db.Add(2); db.Add(2); //Assert Assert.AreEqual(4, db.Count, ErrorMessageForDifferentCount, 4); }
public void DatabaseAddMoreElementsThanCapacityOfDatabase(int count) { //Arrange List <int> list = new List <int>(); for (int i = 0; i < count; i++) { list.Add(i); } IntDataBase db = new IntDataBase(list); //Assert Assert.Throws <InvalidOperationException>(() => db.Add(3), "Cannot add more elements than max capacity"); }