public void Logout_AccessTokenSet_AccessTokenCleared()
        {
            OpenIDConnectService oidc = new OpenIDConnectService();

            typeof(OpenIDConnectService).GetProperty("AccessToken").SetValue(oidc, "abcd");

            oidc.Logout();
            Assert.IsEmpty(oidc.AccessToken);
        }
        public void Logout_EventSubscribed_EventRaised()
        {
            OpenIDConnectService oidc = new OpenIDConnectService();
            int events = 0;

            oidc.LogoutCompleted += delegate
            {
                events++;
            };

            oidc.Logout();
            Assert.AreEqual(1, events);
        }
        public void IsLoggedIn_SuccessfulLogout_ReturnsFalse()
        {
            OpenIDConnectService oidc         = new OpenIDConnectService();
            IOidcProvider        oidcProvider = A.Fake <IOidcProvider>();

            A.CallTo(() => oidcProvider.GetAccessToken(A <Dictionary <string, string> > .Ignored)).Returns("myAccessToken");
            A.CallTo(() => oidcProvider.AuthorizationFlow).Returns(AuthorizationFlow.IMPLICIT);
            oidc.OidcProvider = oidcProvider;
            IRedirectServerListener serverListener = A.Fake <IRedirectServerListener>();

            oidc.ServerListener = serverListener;

            oidc.OpenLoginPage();

            RedirectReceivedEventArgs redirectReceivedEventArgs = A.Fake <RedirectReceivedEventArgs>();

            serverListener.RedirectReceived += Raise.With(redirectReceivedEventArgs);

            oidc.Logout();

            Assert.IsFalse(oidc.IsLoggedIn);
        }