public void DatabaseElementsAreRemovedInLIFOOrder() { var db = new App.Database(1, 2, 3); var lastElement = db.Fetch()[db.LastIndex]; db.Remove(); var lastElementAfterRemoval = db.Fetch()[db.LastIndex]; Assert.That(lastElement, Is.Not.EqualTo(lastElementAfterRemoval), "The removal is either not in LIFO order or the element had not been removed"); }
public void DatabaseCapacityIsExactly16() { var db = new App.Database(); Assert.That(db.Capcaity, Is.EqualTo(16), $"Database.Capacity is not equal to 16! Current value: {db.Capcaity}"); Assert.That(db.Fetch().Length, Is.EqualTo(16), "Database.Fetch returns array not equal to 16!"); }
public void DatabaseElementsAreAddedInLIFOOrder() { var db = new App.Database(1, 8); var addedItem = 5; db.Add(addedItem); var lastItem = db.Fetch()[db.LastIndex]; Assert.That(lastItem, Is.EqualTo(addedItem), "The adding order is not LIFO!"); }
public void DatabaseElementsAreAddedInLIFOOrder() { var peopleArray = this.PersonObjects; var db = new App.Database(peopleArray[0], peopleArray[1]); var addedItem = peopleArray[2]; db.Add(addedItem); var lastItem = db.Fetch()[db.LastIndex]; Assert.That(lastItem, Is.EqualTo(addedItem), "The adding order is not LIFO!"); }
public void DatabaseConstructorStoresValuesInArray() { var defaultArray = new int[] { 3, 2, 1, 8, 7 }; var db = new App.Database(defaultArray); var fetchedArray = db.Fetch(); var elementsAreSaved = true; for (int i = 0; i < defaultArray.Length; i++) { if (defaultArray[i] != fetchedArray[i]) { elementsAreSaved = false; break; } } Assert.That(elementsAreSaved, "There was a missmatch when checking saved elements. Make sure they are saved correctly!"); }