예제 #1
0
 public void Setup()
 {
     _stack = new Fundamentals.Stack <int>();
     _stack.Push(1);
     _stack.Push(2);
     _stack.Push(3);
 }
예제 #2
0
        public void Push_ObjectAddedToList_ListIsEqualToOne()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            Assert.That(stack.Count, Is.EqualTo(1));
        }
예제 #3
0
        public void Push_ValidArgumnet_AddTheObjectToTheStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            Assert.That(stack.Count, Is.EqualTo(1));
        }
예제 #4
0
        public void Push_ObjectIsNull_ThrowObjectNullException(string T)
        {
            var stack = new Fundamentals.Stack <string>();

            // stack.Push(T);
            Assert.That(() => stack.Push(T), Throws.ArgumentNullException);
        }
예제 #5
0
        public void Peek_EmptyStack_ThrowInvalidOperatorException()
        {
            var stack = new Fundamentals.Stack <string>();

            // stack.Push(T);
            Assert.That(() => stack.Peek(), Throws.InvalidOperationException);
        }
예제 #6
0
        public void Peek_StackWithObject_ReturnObjectOnTopOfTheStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("abc");
            Assert.That(stack.Peek(), Is.EqualTo("abc"));
        }
예제 #7
0
        public void Push_InputIsCorrectObject_AddObjectToStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("aaa");
            Assert.That(stack.Count == 1);
        }
예제 #8
0
        public void Push_WhenCalled_AddItemToList()
        {
            var stack = new Fundamentals.Stack <int>();

            stack.Push(1);

            Assert.That(stack.Count == 1);
        }
예제 #9
0
        public void PushMethod_Object_AddItem()
        {
            var newItem = "a";
            var stack   = new Fundamentals.Stack <string>();

            stack.Push(newItem);
            Assert.That(stack.Count, Is.EqualTo(1));
        }
예제 #10
0
        public void Push_WhenObjectIsNotNull_ReturnObjectCount()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");

            Assert.That(stack.Count, Is.EqualTo(1));
        }
예제 #11
0
        public void Push_WhenNullAdded_ThrowsArgumentNullException()
        {
            // Arrange
            var stack = new Fundamentals.Stack <int?>();

            // Act & Arrange
            Assert.Throws <ArgumentNullException>(() => stack.Push(null));
        }
예제 #12
0
        public void Count_NoObjInStack_ReturnZero()
        {
            var stack = new Fundamentals.Stack <string>();

            var result = stack.Count;

            Assert.That(result, Is.EqualTo(0));
        }
예제 #13
0
        public void Peek_WhenCalledOnEmptyStack_ThrowsInvalidOperationException()
        {
            // Arrange
            var stack = new Fundamentals.Stack <int?>();

            // Act & Assert
            Assert.Throws <InvalidOperationException>(() => stack.Peek());
        }
예제 #14
0
        public void Push_ArgIsValid_AddObjToStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");

            Assert.That(stack.Count, Is.EqualTo(1));
        }
예제 #15
0
        public void Pop_EmptyStack_ThrowInvalidOperationException()
        {
            //Arrange
            var stack = new Fundamentals.Stack <string>();

            //Assert
            Assert.That(() => stack.Pop(), Throws.InvalidOperationException);
        }
예제 #16
0
        public void Count_OneObjInStack_ReturnOne()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");
            var result = stack.Count;

            Assert.That(result, Is.EqualTo(1));
        }
예제 #17
0
        public void Push_AddObjectToList_ReturnWithAddedObjectToStack()
        {
            //Arrange
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");

            Assert.That(stack.Count, Is.EqualTo(1));
        }
예제 #18
0
        public void Pop_Returns_Last_Value_In_Stack()
        {
            Fundamentals.Stack <int> numbers = new Fundamentals.Stack <int>();
            numbers.Push(1);
            numbers.Push(2);
            numbers.Push(3);

            Assert.AreEqual(numbers.Pop(), 3);
        }
예제 #19
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));
        }
예제 #20
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"));
        }
예제 #21
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);
        }
예제 #22
0
        public void Pop_StackIsNotEmpty_RemoveObjectFromStack()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("1");
            stack.Push("2");
            stack.Push("3");
            stack.Pop();
            Assert.That(stack.Count == 2);
        }
예제 #23
0
        public void Pop_Valid_TopItem()
        {
            var stack = new Fundamentals.Stack <string>();

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

            Assert.That(stack.Pop(), Is.EqualTo("a"));
        }
예제 #24
0
        public void Pop_StackWithAFewObjects_ReturnObjectOnTop()
        {
            var stack = new Fundamentals.Stack <string>();

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

            Assert.That(stack.Pop(), Is.EqualTo("c"));
        }
예제 #25
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));
        }
예제 #26
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"));
        }
예제 #27
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));
        }
예제 #28
0
        public void Push_WhenCalledOnEmptyStack_StackIsNotEmpty()
        {
            var stack = new Fundamentals.Stack <string>();

            var obj = "string";

            stack.Push(obj);

            Assert.That(stack.Count, Is.EqualTo(1));
        }
예제 #29
0
        public void Push_AddValidObject_ValidObjectAtTopOfStack()
        {
            var stack = new Fundamentals.Stack <object>();

            var newObject = new Object();

            stack.Push(newObject);

            //Assert.That(stack.)
        }
예제 #30
0
        public void Pop_StackWithAFewObjects_RemoveObjectOnTheTop()
        {
            var stack = new Fundamentals.Stack <string>();

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

            Assert.That(stack.Count, Is.EqualTo(1));
        }