Execute() public method

public Execute ( Command command ) : string
command Command
return string
Exemplo n.º 1
0
        public void TestSessionLogin()
        {
            Session session = new Session();
            var passKey = Crypto.prepare_key_pw(Config.TestUserPass);

            Command login = MakeCommand.Login(Config.TestUserName, Config.TestUserHash, passKey);

            string expected = "[-9]"; // -9 is "ENOENT" which means user not found
            string actual = session.Execute(login);

            Assert.AreNotEqual(actual, expected);
        }
Exemplo n.º 2
0
        public void TestSessionLoginFull()
        {
            Session session = new Session();

            var passKey = Crypto.prepare_key_pw(Config.TestUserPass);
            var aes = new Sjcl.Cipher.Aes(passKey);

            string hash = Crypto.stringhash(Config.TestUserName.ToLower(), aes);

            {
                Command login = MakeCommand.Login(Config.TestUserName, hash, passKey);

                string expected = "[-9]"; // -9 is "ENOENT" which means user not found
                string actual = session.Execute(login);

                Assert.AreNotEqual(actual, expected);
            }

            {
                Command userDetails = MakeCommand.GetUserDetails();

                string expected = "";
                string actual = session.Execute(userDetails);

                Assert.AreEqual(actual, expected);
            }
        }