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(); }
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); }
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); }