コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: redwyre/MegaApi
        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);
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: redwyre/MegaApi
        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);
            }
        }