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

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

            stack.Push("a");
            Assert.That(stack.Count, Is.EqualTo(1));
        }
Esempio n. 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);
        }
Esempio n. 5
0
        public void Peek_EmptyStack_ThrowInvalidOperatorException()
        {
            var stack = new Fundamentals.Stack <string>();

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

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

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

            stack.Push(1);

            Assert.That(stack.Count == 1);
        }
Esempio n. 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));
        }
Esempio n. 10
0
        public void Push_WhenObjectIsNotNull_ReturnObjectCount()
        {
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");

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

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

            var result = stack.Count;

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

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

            stack.Push("a");

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

            //Assert
            Assert.That(() => stack.Pop(), Throws.InvalidOperationException);
        }
Esempio n. 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));
        }
Esempio n. 17
0
        public void Push_AddObjectToList_ReturnWithAddedObjectToStack()
        {
            //Arrange
            var stack = new Fundamentals.Stack <string>();

            stack.Push("a");

            Assert.That(stack.Count, Is.EqualTo(1));
        }
Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 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"));
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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"));
        }
Esempio n. 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"));
        }
Esempio n. 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));
        }
Esempio n. 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"));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 29
0
        public void Push_AddValidObject_ValidObjectAtTopOfStack()
        {
            var stack = new Fundamentals.Stack <object>();

            var newObject = new Object();

            stack.Push(newObject);

            //Assert.That(stack.)
        }
Esempio n. 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));
        }