Пример #1
0
        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!");
        }
Пример #2
0
        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!");
        }
Пример #3
0
        private void CheckForExceptionOnAdding(List <IPerson> peopleList, IPerson newPerson, string message)
        {
            //Make sure repeating usernames are rejected on creation
            peopleList.Add(newPerson);

            Assert.That(() => new App.Database(peopleList.ToArray()), Throws.InvalidOperationException);

            //Make sure repeating usernames are rejected on addition
            peopleList.Remove(peopleList.Last());

            var db = new App.Database(peopleList.ToArray());

            Assert.That(() => db.Add(newPerson), Throws.InvalidOperationException);
        }
Пример #4
0
        public void DatabaseShouldThrowInvalidOperationExceptionIfOverflows16()
        {
            var db = new App.Database(new int[16]);

            Assert.That(() => db.Add(1), Throws.InvalidOperationException);
        }
Пример #5
0
        public void DatabaseShouldThrowInvalidOperationExceptionIfOverflows16()
        {
            var db = new App.Database(this.PersonObjects);

            Assert.That(() => db.Add(this.people[0].Object), Throws.InvalidOperationException);
        }