Esempio n. 1
0
        public void Peek_StackWithItems_ReturnsTopItem()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            var result = stack.Peek();

            Assert.That(stack.Peek(), Is.EqualTo("b"));
        }
Esempio n. 2
0
        public void Peek_StackWithObject_ReturnObjectOnTopOfTheStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("abc");
            Assert.That(stack.Peek(), Is.EqualTo("abc"));
        }
Esempio n. 3
0
        public void Peek_EmptyStack_ThrowInvalidOperatorException()
        {
            var stack = new Fundamentals.Stack <string>();

            // stack.Push(T);
            Assert.That(() => stack.Peek(), Throws.InvalidOperationException);
        }
Esempio n. 4
0
        public void Peek_WhenCalledOnEmptyStack_ThrowsInvalidOperationException()
        {
            // Arrange
            var stack = new Fundamentals.Stack <int?>();

            // Act & Assert
            Assert.Throws <InvalidOperationException>(() => stack.Peek());
        }
Esempio n. 5
0
        public void Peek_StackWithObject_DoesNotRemoveTheObjectAtTheTopOfTheStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            var dummy = stack.Peek();

            Assert.That(stack.Count, Is.EqualTo(1));
        }
Esempio n. 6
0
        public void Peek_StackIsNotEmpty_DoesNotRemoveObjectOfTheStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("1");
            stack.Push("2");
            stack.Push("3");
            stack.Peek();
            Assert.That(stack.Count == 3);
        }
Esempio n. 7
0
        public void Peek_StackWithAFewObj_ReturnObjOnTopOfStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            stack.Push("c");

            Assert.That(() => stack.Peek(), Is.EqualTo("c"));
        }
Esempio n. 8
0
        public void Peek_Peeking_ReturnsTopStackValue()
        {
            var stack = new Fundamentals.Stack <int>();

            stack.Push(1);
            stack.Push(2);
            var result = stack.Peek();

            Assert.That(result, Is.EqualTo(2));
        }
Esempio n. 9
0
        public void Peek_StackWithItems_CountDoesntChange()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            var result = stack.Peek();

            Assert.That(stack.Count, Is.EqualTo(2));
        }
Esempio n. 10
0
        public void Peek_StackIsNotEmpty_PickElementFromStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("1");
            stack.Push("2");
            stack.Push("3");
            var lastElement = stack.Peek();

            Assert.That(lastElement == "3");
        }
Esempio n. 11
0
        public void PeekMethod_WhenCalled_ReturnLastElementInStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            stack.Push("c");

            var result = stack.Peek();

            Assert.That(result, Is.EqualTo("c"));
        }
Esempio n. 12
0
        public void Peek_StackWithAFewObjects_ListSizeRemainsTheSame()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            stack.Push("c");

            var result = stack.Peek();

            Assert.That(stack.Count, Is.EqualTo(3));
        }
Esempio n. 13
0
        public void Push_WhenCalled_AddsItemToStackAndIncrementsCount()
        {
            // Arrange
            var stack = new Fundamentals.Stack <int>();

            // Act
            stack.Push(1);

            // Assert
            Assert.Equal(1, stack.Count);
            Assert.Equal(1, stack.Peek());
        }
Esempio n. 14
0
        public void Peek_StackWithFewObjects_KeepTheSameStackCount()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            stack.Push("c");

            stack.Peek();

            Assert.That(stack.Count, Is.EqualTo(3));
        }
Esempio n. 15
0
        public void Peek_StackWhithAFewObjects_ReturnObjectOnTheTop()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            stack.Push("c");

            var result = stack.Peek();

            Assert.That(result, Is.EqualTo("c"));
        }
Esempio n. 16
0
        public void Peek_StackWhithAFewObjects_DontRemoveObjectOnTheTop()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            stack.Push("c");

            stack.Peek();

            Assert.That(stack.Count, Is.EqualTo(3));
        }
Esempio n. 17
0
        public void Peek_StackWithObjects_DoesNotRemoveTheObjectOnTopOfTheStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            stack.Push("c");

            stack.Peek();

            Assert.That(stack.Count, Is.EqualTo(3));
        }
Esempio n. 18
0
        public void PeekMethod_WhenCalled_DoesNotRemoveTheObject()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            stack.Push("c");

            var result = stack.Peek();

            Assert.That(stack.Count, Is.EqualTo(3));
        }
Esempio n. 19
0
        public void Peek_WithAFewObjects_DoesNotRemoveAnyObject()
        {
            //Arrange
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            stack.Push("c");
            //Act
            stack.Peek();
            //Assert
            Assert.That(stack.Count, Is.EqualTo(3));
        }
Esempio n. 20
0
        public void Peek_WhenCalledOnNonEmptyStack_ReturnsTopStackItem()
        {
            // Arrange
            var stack = new Fundamentals.Stack <int?>();

            // Act
            stack.Push(1);
            stack.Push(2);
            var result = stack.Peek();

            // Assert
            Assert.Equal(2, result);
        }
Esempio n. 21
0
        public void Peek_WithAFewObjects_ReturnsObjectAtTopOfStack()
        {
            //Arrange
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            stack.Push("b");
            stack.Push("c");
            //Act
            var result = stack.Peek();

            //Assert
            Assert.That(result, Is.EqualTo("c"));
        }
Esempio n. 22
0
 public void Peek_StackCountZero_throwException()
 {
     Assert.Throws <InvalidOperationException>(() => stack.Peek());
 }
Esempio n. 23
0
        public void PeekMethod_EmptyStack_ThrowsInvalidOperationException()
        {
            var stack = new Fundamentals.Stack <string>();

            Assert.That(() => stack.Peek(), Throws.Exception.TypeOf <InvalidOperationException>());
        }
Esempio n. 24
0
        public void Peek_StackIsEmpty_ReturnInvalidOperationException()
        {
            var stack = new Fundamentals.Stack <string>();

            Assert.That(() => stack.Peek(), Throws.InvalidOperationException);
        }
Esempio n. 25
0
        public void Peek_CountIsZero_ReturnsInvalidOperationException()
        {
            var stack = new Fundamentals.Stack <object>();

            Assert.That(() => stack.Peek(), Throws.InvalidOperationException);
        }
Esempio n. 26
0
        public void Peek_Throws_InvalidOperationException_When_Stack_Is_Empty()
        {
            Fundamentals.Stack <string> strings = new Fundamentals.Stack <string>();

            Assert.Throws <InvalidOperationException>(() => strings.Peek());
        }
Esempio n. 27
0
 public void Peek_ListCountIsZero_ThrowInvalidOperationException()
 {
     Assert.Throws <InvalidOperationException>(() => _stack.Peek());
 }
Esempio n. 28
0
        public void Peek_WhenCalledOnZeroCountStack_ReturnsInvalidOperationException()
        {
            var stack = new Fundamentals.Stack <string>();

            Assert.That(() => stack.Peek(), Throws.InvalidOperationException);
        }
Esempio n. 29
0
        public void Peek_NoObjInStack_ThrowInvalidOperationException()
        {
            var stack = new Fundamentals.Stack <string>();

            Assert.That(() => stack.Peek(), Throws.InvalidOperationException);
        }
Esempio n. 30
0
        public void Peek_Return_Last_Item_In_Stack()
        {
            int actualResult = _stack.Peek();

            Assert.AreEqual(actualResult, 3);
        }