public void any_user_can_logout() { //arrange var authService = new Mock <IAuthService>(); authService.Setup(x => x.SignOut()); //act var sut = new UserControllerBuilder().WithAuthService(authService.Object) .Build(); var result = sut.Logout(); //assert Assert.IsNotNull(result); Assert.IsAssignableFrom <RedirectResult>(result); sut.AssertGetAttribute(ACTION_LOGOUT); }
public async void logout_should_redirect() { //arrange var formsAuthenticationService = new Mock <IFormsAuthenticationService>(); formsAuthenticationService.Setup(x => x.SignOut()); //act var sut = new UserControllerBuilder().WithFormsAuthenticationService(formsAuthenticationService.Object) .Build(); var view = sut.Logout() as RedirectResult; //assert Assert.NotNull(view); Assert.AreEqual(view.Url, "/"); sut.AssertGetAttribute("Logout"); }