예제 #1
0
        public void ParseNullCommand()
        {
            CommandReader reader = new CommandReader(string.Empty);

            CommandInfo command = reader.NextCommand();

            Assert.IsNull(command);
        }
예제 #2
0
        public void LineReaderParseOnlyOneCommandInFirstLine()
        {
            CommandReader reader = new CommandReader(new StringReader("get key1\r\nget key2"), true);

            CommandInfo command = reader.NextCommand();
            Assert.IsNotNull(command);

            Assert.IsNull(reader.NextCommand());
        }
예제 #3
0
        public void ParseGetCommand()
        {
            CommandReader reader = new CommandReader("get users:1:name");

            CommandInfo command = reader.NextCommand();

            Assert.IsNotNull(command);
            Assert.AreEqual("get", command.Verb);
            Assert.AreEqual("users:1:name", command.Key);
            Assert.IsNull(command.Parameters);
        }
예제 #4
0
        public void ParseSetCommand()
        {
            CommandReader reader = new CommandReader("set users:1:name \"Adam\"");

            CommandInfo command = reader.NextCommand();

            Assert.IsNotNull(command);
            Assert.AreEqual("set", command.Verb);
            Assert.AreEqual("users:1:name", command.Key);
            Assert.IsNotNull(command.Parameters);
            Assert.AreEqual(1, command.Parameters.Count);
            Assert.AreEqual("Adam", command.Parameters[0]);
        }
예제 #5
0
        public void RaiseWhenVerbIsNotAName()
        {
            CommandReader reader = new CommandReader("1");

            CommandInfo command = reader.NextCommand();
        }
예제 #6
0
        public void RaiseWhenNoKey()
        {
            CommandReader reader = new CommandReader("get");

            CommandInfo command = reader.NextCommand();
        }
예제 #7
0
 public Processor(Repository repository, CommandReader reader)
 {
     this.repository = repository;
     this.reader = reader;
 }