コード例 #1
0
        public void Cleanup_ServerNotRunning_ServerNotStopped()
        {
            OpenIDConnectService    oidc           = new OpenIDConnectService();
            IRedirectServerListener serverListener = A.Fake <IRedirectServerListener>();

            A.CallTo(() => serverListener.ServerActive).Returns(false);
            oidc.ServerListener = serverListener;

            oidc.Cleanup();

            A.CallTo(() => serverListener.StopServerImmediately()).MustNotHaveHappened();
        }
コード例 #2
0
        public void Cleanup_LoggedOut_DoesNotRaiseLogoutEvent()
        {
            OpenIDConnectService oidc = new OpenIDConnectService();

            oidc.ServerListener = A.Fake <IRedirectServerListener>();

            int eventCalls = 0;

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

            oidc.Cleanup();

            Assert.AreEqual(0, eventCalls);
        }
コード例 #3
0
        public void Cleanup_LoggedIn_RaisesLogoutEvent()
        {
            OpenIDConnectService oidc = new OpenIDConnectService();

            oidc.ServerListener = A.Fake <IRedirectServerListener>();
            typeof(OpenIDConnectService).GetProperty("AccessToken").SetValue(oidc, "abcd");

            int eventCalls = 0;

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

            oidc.Cleanup();

            Assert.AreEqual(1, eventCalls);
        }