예제 #1
0
        public void InsertSweepstakes_InsertTwoSweepstakes_TopStackIsTheSecondOneAdded()
        {
            //Arrange
            SweepstakesStackManager stackManager = new SweepstakesStackManager();
            string expected = "that";

            //Act
            stackManager.InsertSweepstakes(new Sweepstakes("this"));
            stackManager.InsertSweepstakes(new Sweepstakes("that"));
            //Assert
            Assert.AreEqual(expected, stackManager.Stack.Pop().Name);
        }
예제 #2
0
        public void InsertSweepstakes_InsertTwoSweepstakes_CountOfStackIsTwo()
        {
            //Arrange
            SweepstakesStackManager stackManager = new SweepstakesStackManager();
            int expected = 2;

            //Act
            stackManager.InsertSweepstakes(new Sweepstakes("this"));
            stackManager.InsertSweepstakes(new Sweepstakes("that"));
            //Assert
            Assert.AreEqual(expected, stackManager.Stack.Count);
        }
        [TestMethod] // Test 3
        // Must make underlying stack element public in order to run test
        public void Stack_Add3Sweepstakes_StackCountIs3()
        {
            // Arrange
            SweepstakesStackManager stack        = new SweepstakesStackManager();
            Sweepstakes             sweepstakes1 = new Sweepstakes("1");
            Sweepstakes             sweepstakes2 = new Sweepstakes("2");
            Sweepstakes             sweepstakes3 = new Sweepstakes("3");
            int expected = 3;
            int actual;

            // Act
            stack.InsertSweepstakes(sweepstakes1);
            stack.InsertSweepstakes(sweepstakes2);
            stack.InsertSweepstakes(sweepstakes3);
            actual = stack.stack.Count;

            // Assert

            Assert.AreEqual(expected, actual);
        }
        [TestMethod] // Test 4
        // Must make underlying stack element public in order to run test
        public void Stack_Add3Sweepstakes_RemoveSweepstakes_SweepstakesIndex0IsSweepstakes1()
        {
            // Arrange
            SweepstakesStackManager stack        = new SweepstakesStackManager();
            Sweepstakes             sweepstakes1 = new Sweepstakes("1");
            Sweepstakes             sweepstakes2 = new Sweepstakes("2");
            Sweepstakes             sweepstakes3 = new Sweepstakes("3");
            string expected = "1";
            string actual;

            // Act
            stack.InsertSweepstakes(sweepstakes1);
            stack.InsertSweepstakes(sweepstakes2);
            stack.InsertSweepstakes(sweepstakes3);
            stack.GetSweepstakes();
            actual = stack.stack.ElementAt(0).Name;

            // Assert

            Assert.AreEqual(expected, actual);
        }