Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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");
        }