Exemplo n.º 1
0
        public void Capacity_ShowStackCapacity_Size() //Verificar se o método "Capacity()" dá o tamanho total da stack
        {
            //Arrange
            var stack = new DJDStack <int>();

            //Assert
            Assert.AreEqual(stack.size, stack.Capacity());
        }
Exemplo n.º 2
0
        public void Peek_ShowValueBelowIndexZero_InvalidOperationException() //Verificar se a exceção ocorre quando tentamos dar "Peek" com index < 0
        {
            //Arrange
            var stack = new DJDStack <int>();

            //Assert
            Assert.Throws <InvalidOperationException>(() => stack.Peek());
        }
Exemplo n.º 3
0
        public void Length_ShowLengthBelowIndexZero_InvalidOperationException() //Verificar se a exceção ocorre quando tentamos saber qual o tamanho em uso com index < 0
        {
            //Arrange
            var stack = new DJDStack <int>();

            //Assert
            Assert.Throws <InvalidOperationException>(() => stack.Lenght());
        }
Exemplo n.º 4
0
        public void Length_ShowLengthAboveIndexZero_UsedStackLength() //Verificar se o método "Length()" dá o tamanho em uso da stack
        {
            //Arrange
            var stack = new DJDStack <int>();

            //Act
            stack.Push(5);

            //Assert
            Assert.AreEqual(1, stack.Lenght());
        }
Exemplo n.º 5
0
        public void Push_ResizeStack_SizeDoubles() //Verificar se a "Stack" duplica quando chegamos ao limite
        {
            //Arrange (Inicializamos os nossos objetos)
            var stack = new DJDStack <int>();

            //Act (Simulamos o input)
            for (int i = 0; i < 7; i++)
            {
                stack.Push(i);
            }

            //Assert (Verifica se o resultado foi correto)
            Assert.AreEqual(12, stack.size);
        }