Пример #1
0
        public void ProcessingStack_ReadAndWriteState_Test()
        {
            string    val = null;
            StateInfo Step;

            Assert.AreEqual(StateInfo.PUSHED, StackUnderTest.StackTop_Step);
            Assert.AreEqual("hello", StackUnderTest.StackTop_Item);

            StackUnderTest.StackTop_Step = StateInfo.PROCESSED;
            Assert.AreEqual(StateInfo.PROCESSED, StackUnderTest.StackTop_Step);

            Step = StackUnderTest.Pop(ref val);
            Assert.AreEqual(StateInfo.PROCESSED, Step);
            Assert.AreEqual("hello", val);

            Assert.AreEqual(StateInfo.PUSHED, StackUnderTest.StackTop_Step);
            StackUnderTest.StackTop_Step = StateInfo.READY_TO_POP;
            Assert.AreEqual(StateInfo.READY_TO_POP, StackUnderTest.StackTop_Step);

            StackUnderTest.Pop();
            Assert.AreEqual(StateInfo.PUSHED, StackUnderTest.StackTop_Step);
            Assert.AreEqual("good bye", StackUnderTest.StackTop_Item);

            StackUnderTest.Pop();
            Assert.AreEqual(StateInfo.ERROR, StackUnderTest.StackTop_Step);
        }
Пример #2
0
        private void BackToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (_stack.Count < 2)
            {
                return;
            }

            var peek = _stack.Pop();

            pictureBox.Image = new Bitmap(peek.Bitmap);
            DrawPoint();
            pictureBox.Refresh();
        }