예제 #1
0
        public void OnceLoggedInCanLogout()
        {
            var facade = new WorkflowFacade();

            facade.ExecuteAction(typeof(LoginAction), new LoginCredentials("username", "password"));

            facade.ExecuteAction(typeof(LogoutAction), null);

            var actions        = facade.GetAvailableActions();
            var loginAvailable = actions.Any(IsLoginAction());

            Assert.That(loginAvailable, Is.True);
        }
예제 #2
0
        public void WhenIncorrectLoginDetailsSuppliedResultIsANullSession()
        {
            var facade = new WorkflowFacade();

            var result = facade.ExecuteAction(typeof(LoginAction), new LoginCredentials("username", ""));

            Assert.That(result, Is.TypeOf <NullSession>());
        }
예제 #3
0
        public void WhenCorrectLoginCredentialsSuppliedResultIsASessionId()
        {
            var facade = new WorkflowFacade();

            var result = facade.ExecuteAction(typeof(LoginAction), new LoginCredentials("username", "password"));

            Assert.That(result, Is.TypeOf <SessionId>());
        }
예제 #4
0
        public void WhenLoginUnsuccessfulWorkflowActionRemainsAsLogin()
        {
            var facade = new WorkflowFacade();

            facade.ExecuteAction(typeof(LoginAction), new LoginCredentials("username", ""));

            var actionsPostLogin = facade.GetAvailableActions();

            var postLoginAction = actionsPostLogin.First();

            Assert.That(postLoginAction, Is.EqualTo(typeof(LoginAction)));
        }
예제 #5
0
        public void AfterSuccessfulLoginThroughWorkflowActionBecomesLogout()
        {
            var facade  = new WorkflowFacade();
            var actions = facade.GetAvailableActions();

            facade.ExecuteAction(actions.First(), new LoginCredentials("username", "password"));

            var actionsPostLogin = facade.GetAvailableActions();

            var postLoginAction = actionsPostLogin.First(IsLogoutAction());

            Assert.That(postLoginAction, Is.EqualTo(typeof(LogoutAction)));
        }