Esempio n. 1
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());
        }
Esempio n. 2
0
        public void ParseNullCommand()
        {
            CommandReader reader = new CommandReader(string.Empty);

            CommandInfo command = reader.NextCommand();

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

            CommandInfo command = reader.NextCommand();
        }
Esempio n. 6
0
        public void RaiseWhenKeyIsNotAName()
        {
            CommandReader reader = new CommandReader("get 1");

            CommandInfo command = reader.NextCommand();
        }