示例#1
0
        public void TestCommit()
        {
            TestCommandProvider commandProvier = NewCommandProvider("commit");
            TestDatabase        db             = new TestDatabase();
            CommandLine         commandLine    = new CommandLine(db, commandProvier);

            commandLine.Run();

            Assert.AreEqual("bye", commandProvier.DequeueMessage());
            Assert.AreEqual(1, db.CommitCalls);
        }
示例#2
0
        public void TestUnknownCommand()
        {
            TestCommandProvider commandProvier = NewCommandProvider("fire all missiles");
            TestDatabase        db             = new TestDatabase();
            CommandLine         commandLine    = new CommandLine(db, commandProvier);

            commandLine.Run();

            Assert.AreEqual("ERROR - Unknown command.", commandProvier.DequeueMessage());
            Assert.AreEqual("bye", commandProvier.DequeueMessage());
        }
示例#3
0
        public void TestPutRef()
        {
            TestCommandProvider commandProvier = NewCommandProvider("putref blue green");
            TestDatabase        db             = new TestDatabase();
            CommandLine         commandLine    = new CommandLine(db, commandProvier);

            commandLine.Run();

            Assert.AreEqual("bye", commandProvier.DequeueMessage());
            Assert.AreEqual(1, db.PutRefCalls);
        }
示例#4
0
        public void TestTooFewArgs()
        {
            TestCommandProvider commandProvier = NewCommandProvider("put");
            TestDatabase        db             = new TestDatabase();
            CommandLine         commandLine    = new CommandLine(db, commandProvier);

            commandLine.Run();

            Assert.AreEqual("ERROR - Not enough arguments for command put.", commandProvier.DequeueMessage());
            Assert.AreEqual("bye", commandProvier.DequeueMessage());
        }