Exemplo n.º 1
0
        public void TestGetPreviousCommand()
        {
            var commandHistory = new CommandHistory();

            commandHistory.Add("A0001");
            string command = commandHistory.GetPreviousCommand();
            Assert.AreEqual("A0001", command);
            command = commandHistory.GetPreviousCommand();
            Assert.AreEqual("A0001", command);

            commandHistory.Add("A0002");
            command = commandHistory.GetPreviousCommand();
            Assert.AreEqual("A0002", command);
            command = commandHistory.GetPreviousCommand();
            Assert.AreEqual("A0001", command);
            command = commandHistory.GetPreviousCommand();
            Assert.AreEqual("A0001", command);

            commandHistory.Add("A0003");
            command = commandHistory.GetPreviousCommand();
            Assert.AreEqual("A0003", command);
            command = commandHistory.GetPreviousCommand();
            Assert.AreEqual("A0002", command);
            command = commandHistory.GetPreviousCommand();
            Assert.AreEqual("A0001", command);
            command = commandHistory.GetPreviousCommand();
            Assert.AreEqual("A0001", command);
        }
Exemplo n.º 2
0
        public void TestEmptyHistoryNavigation()
        {
            var commandHistory = new CommandHistory();
            
            string command = commandHistory.GetPreviousCommand();
            Assert.IsEmpty(command);

            command = commandHistory.GetNextCommand();
            Assert.IsEmpty(command);
        }