public void LoginThenLogout() { AuthenticationService1 context = new AuthenticationService1(TestURIs.AuthenticationService1); FormsAuthentication service = new FormsAuthentication(); service.DomainContext = context; AuthenticationOperation ao = service.Login("manager", "manager"); this.EnqueueConditional(() => ao.IsComplete); this.EnqueueCallback(() => { Assert.IsTrue(ao.User.Identity.IsAuthenticated, "Logged in user should be authenticated."); ao = service.Logout(false); }); this.EnqueueConditional(() => ao.IsComplete); this.EnqueueCallback(() => { Assert.IsFalse(ao.User.Identity.IsAuthenticated, "Logged out user should not be authenticated."); ao = service.Logout(false); }); this.EnqueueTestComplete(); }
public void LoginThenLogout() { AuthenticationService1 context = new AuthenticationService1(TestURIs.AuthenticationService1); FormsAuthentication service = new FormsAuthentication(); service.DomainContext = context; AuthenticationOperation ao = service.Login("manager", "manager"); this.EnqueueCompletion(() => ao); this.EnqueueCallback(() => { Assert.IsTrue(ao.User.Identity.IsAuthenticated, "Logged in user should be authenticated."); ao = service.Logout(false); }); this.EnqueueCompletion(() => ao); this.EnqueueCallback(() => { Assert.IsFalse(ao.User.Identity.IsAuthenticated, "Logged out user should not be authenticated."); ao = service.Logout(false); }); this.EnqueueTestComplete(); }