public void DatabaseCapacityIsSixteen() { IntDataBase db = new IntDataBase(new List <int>() { 1, 2 }); Assert.AreEqual(16, db.Capacity, "Capacity must be 16"); }
public void DatebaseElementsReturnsValidCollection() { //Arrange IntDataBase db = new IntDataBase(new List <int>() { 1, 2, 3 }); //Assert CollectionAssert.AreEqual(new int[] { 1, 2, 3 }, db.Elements); Assert.AreEqual(3, db.Count, string.Format(ErrorMessageForDifferentCount, 3)); }
public void DatabaseAddElement() { //Arrange IntDataBase db = new IntDataBase(new List <int>() { 1 }); //Act db.Add(2); //Assert Assert.AreEqual(2, db.Count, ErrorMessageForDifferentCount, 2); }
public void RemoveSingleElement() { //Arrange IntDataBase db = new IntDataBase(new List <int>() { 1, 2, 3, 4 }); //Act db.Remove(); //Assert CollectionAssert.AreEqual(new int[] { 1, 2, 3 }, db.Elements); }
public void CheckIfAddedElementsIsLastElementInCollection() { //Arrange IntDataBase db = new IntDataBase(new List <int>() { 1 }); //Act db.Add(2); //Assert CollectionAssert.AreEqual(new int[] { 1, 2 }, db.Elements); }
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"); }
public void RemoveMoreElementsThanCollectionHave() { //Arrange IntDataBase db = new IntDataBase(new List <int>() { 1, 2 }); //Act db.Remove(); db.Remove(); //Assert Assert.Throws <InvalidOperationException>(() => db.Remove()); }
public void DatebaseContructorWorkWithValidNumberOfElements(int count) { //Arrange List <int> list = new List <int>(); for (int i = 0; i < count; i++) { list.Add(i); } //Act IntDataBase db = new IntDataBase(list); //Assert Assert.AreEqual(count, db.Count, string.Format(ErrorMessageForDifferentCount, count)); }