Esempio n. 1
0
        public void WhenTheWorkFlowIsInitializedTheFirstActionIsLogin()
        {
            var facade  = new WorkflowFacade();
            var actions = facade.GetAvailableActions();

            Assert.That(actions.Any(IsLoginAction()), Is.True);
        }
Esempio n. 2
0
        public void WhenIncorrectLoginDetailsSuppliedResultIsANullSession()
        {
            var facade = new WorkflowFacade();

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

            Assert.That(result, Is.TypeOf <NullSession>());
        }
Esempio n. 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>());
        }
Esempio n. 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)));
        }
Esempio n. 5
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);
        }
Esempio n. 6
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)));
        }