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); }
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()); }
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); }
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()); }