Exemplo n.º 1
0
        public void ParseNullCommand()
        {
            CommandReader reader = new CommandReader(string.Empty);

            CommandInfo command = reader.NextCommand();

            Assert.IsNull(command);
        }
Exemplo n.º 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());
        }
Exemplo n.º 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);
        }
Exemplo n.º 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]);
        }
Exemplo n.º 5
0
        public void RaiseWhenVerbIsNotAName()
        {
            CommandReader reader = new CommandReader("1");

            CommandInfo command = reader.NextCommand();
        }
Exemplo n.º 6
0
        public void RaiseWhenNoKey()
        {
            CommandReader reader = new CommandReader("get");

            CommandInfo command = reader.NextCommand();
        }
Exemplo n.º 7
0
 public Processor(Repository repository, CommandReader reader)
 {
     this.repository = repository;
     this.reader = reader;
 }