public void ErrBadClient(bool pLogin)
        {
            IsReadOnlyTest = true;
            vClientId      = "999";
            OauthException e;

            if (pLogin)
            {
                e = TestUtil.Throws <OauthException>(() => ExecuteLogin());
            }
            else
            {
                e = TestUtil.Throws <OauthException>(() => ExecuteScope());
            }

            XOauthLoginGetOperation.CheckException(e,
                                                   LoginErrors.unauthorized_client, LoginErrorDescs.BadClient);
        }
        public void SuccessScopeDeny()
        {
            const long memId  = (long)SetupMemberId.BookZach;
            const long userId = (long)SetupUserId.Zach;

            OpCtx.Auth.SetCookieUserId(userId);
            vAllowScope = false;

            Member origMem = XOauthLoginGetOperation.GetMember(OpCtx.Data, memId);

            Assert.AreEqual(true, origMem.OauthScopeAllow, "This test requires an allowed scope.");

            OauthException e = TestUtil.Throws <OauthException>(() => ExecuteScope());

            XOauthLoginGetOperation.CheckException(e,
                                                   LoginErrors.access_denied, LoginErrorDescs.AccessDeny);

            Member updatedMem = XOauthLoginGetOperation.GetMember(OpCtx.Data, memId);

            Assert.AreEqual(false, updatedMem.OauthScopeAllow, "Incorrect OauthScopeAllow.");
            Assert.AreNotEqual(origMem.OauthScopeAllow, updatedMem.OauthScopeAllow,
                               "OauthScopeAllow did not change.");
        }
        public void SuccessScopeUpdate()
        {
            const long memId  = (long)SetupMemberId.BookZach;
            const long userId = (long)SetupUserId.Zach;

            OpCtx.Auth.SetCookieUserId(userId);

            Member origMem = XOauthLoginGetOperation.GetMember(OpCtx.Data, memId);

            Assert.AreEqual(true, origMem.OauthScopeAllow, "This test requires an allowed scope.");

            OauthLoginResult result = ExecuteScope();

            Member updatedMem = XOauthLoginGetOperation.GetMember(OpCtx.Data, memId);

            Assert.AreEqual(updatedMem.OauthGrantCode, result.Code, "Incorrect Code.");
            Assert.AreEqual(updatedMem.OauthGrantRedirectUri, result.Redirect, "Incorrect Redirect.");

            Assert.AreNotEqual(origMem.OauthGrantCode, updatedMem.OauthGrantCode,
                               "OauthGrantCode did not change.");
            Assert.AreNotEqual(origMem.OauthGrantRedirectUri, updatedMem.OauthGrantRedirectUri,
                               "OauthGrantRedirectUri did not change.");
        }