Exemplo n.º 1
0
		public void Correctly_logs_users_out_and_redirects_them_to_the_login_page()
		{
			MockRepository mocks = new MockRepository();

			IWebContext context = mocks.CreateMock<IWebContext>();
			IAuthenticationService authenticationService = mocks.CreateMock<IAuthenticationService>();

			using (mocks.Record())
			{
				authenticationService.Logout();
				Expect.Call(authenticationService.GetLoginUrl()).Return("Login.aspx");
				context.Redirect("Login.aspx");
			}

			using (mocks.Playback())
			{
				ILoginService loginService = new LoginService(null, authenticationService, context);
				loginService.Logout();
			}

			mocks.VerifyAll();
		}