public void when_not_logged_in_should_redirect_to_login_page() { var secureSession = Substitute.For<ISecureSession<Token>>(); secureSession.IsLoggedIn().Returns(false); var outputWriter = Substitute.For<IOutputWriter>(); var actionBehavior = Substitute.For<IActionBehavior>(); var behavior = new AuthorizationBehavior(outputWriter, actionBehavior, secureSession); behavior.Invoke(); actionBehavior.DidNotReceive().Invoke(); outputWriter.Received().RedirectToUrl(AuthorizationBehavior.LoginUrl); }
public void when_logged_in_should_continue() { var secureSession = Substitute.For<ISecureSession<Token>>(); secureSession.IsLoggedIn().Returns(true); var outputWriter = Substitute.For<IOutputWriter>(); var actionBehavior = Substitute.For<IActionBehavior>(); var behavior = new AuthorizationBehavior(outputWriter, actionBehavior, secureSession); behavior.Invoke(); outputWriter.DidNotReceiveWithAnyArgs().RedirectToUrl(null); actionBehavior.Received().Invoke(); }