Exemplo n.º 1
0
        public void UseDataProvPerson()
        {
            Assert.False(vContext.UseAppDataProvider, "Incorrect UseDataProvPerson value.");
            IFabricOauthSession actSess = vContext.ActiveSess;

            Assert.AreNotEqual(vAppSess, actSess, "Incorrect ActiveSess.");
            Assert.AreEqual(1, vSessProvCounter, "Incorrect Session Provider count.");

            vContext.UseAppDataProvider = true;
            Assert.True(vContext.UseAppDataProvider, "Incorrect UseDataProvPerson value.");
            Assert.AreEqual(vAppSess, vContext.ActiveSess, "Incorrect ActiveSess.");
            Assert.AreEqual(1, vSessProvCounter, "Incorrect Session Provider count.");

            vContext.UseAppDataProvider = false;
            Assert.False(vContext.UseAppDataProvider, "Incorrect UseDataProvPerson value.");
            IFabricOauthSession actSess2 = vContext.ActiveSess;

            Assert.AreEqual(actSess, actSess2, "Incorrect ActiveSess.");
            Assert.AreEqual(1, vSessProvCounter, "Incorrect Session Provider count.");
        }
Exemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public T Send(IClientContext pContext, SessionType pSessionType)
        {
            switch (pSessionType)
            {
            case SessionType.Default:
                vSess = pContext.ActiveSess;
                break;

            case SessionType.App:
                vSess = pContext.AppSess;
                break;

            case SessionType.Person:
                vSess = pContext.PersonSess;
                break;
            }

            pContext.LogDebug("SEND: " + pSessionType + " / " + vSess + " / " + pContext.AppSess);
            FabricResponse <T> resp = GetFabricResponse(pContext);

            if (resp.RespError != null)
            {
                pContext.LogError("Request Exception: " + resp.RespError.Error.Code + " / " +
                                  resp.RespError.Error.Name + " / " + resp.RespError.Error.Message);
                throw new FabricErrorException(resp.RespError);
            }

            if (resp.OauthError != null)
            {
                pContext.LogError("Request OAuth Exception: " +
                                  resp.OauthError.error + " / " + resp.OauthError.error_description);
                throw new FabricErrorException(resp.OauthError);
            }

            return(resp.Data);
        }