Exemplo n.º 1
0
        public void ShouldPushMethodIncreaseItemCount()
        {
            var cut = new Challenge43();

            cut.Push(1);
            cut.Push(2);
            cut.Push(3);

            cut.Count().ShouldBe(3);
        }
Exemplo n.º 2
0
        public void ShouldMaxRetrunsMaximumValueInStack(int[] values, int expectedMaxValue)
        {
            var cut = new Challenge43();

            for (int i = 0; i < values.Length; i++)
            {
                cut.Push(values[i]);
            }

            var max = cut.Max();

            max.ShouldBe(expectedMaxValue);
        }
Exemplo n.º 3
0
        public void ShouldPopReturnsTopmostElement(int[] initialList, int initialPopValue, int[] secondaryList, int secondaryValue)
        {
            var cut = new Challenge43();

            for (int i = 0; i < initialList.Length; i++)
            {
                cut.Push(initialList[i]);
            }

            var item1 = cut.Pop();

            item1.ShouldBe(initialPopValue);

            for (int j = 0; j < secondaryList.Length; j++)
            {
                cut.Push(secondaryList[j]);
            }

            var item2 = cut.Pop();

            item2.ShouldBe(secondaryValue);
        }