public async Task LoginFailed()
        {
            var loginFormModel = new LoginFormModel();
            var controller     = new Controller(loginFormModel);

            controller.Machine.HandleResponseAsync("login", new HttpResponseMessage(HttpStatusCode.Unauthorized));
            Assert.Equal("Credentials invalid", loginFormModel.StatusMessage);
        }
        public async Task LoginSuccessful()
        {
            var loginFormModel = new LoginFormModel();
            var controller     = new Controller(loginFormModel);

            controller.Machine.HandleResponseAsync("login", new HttpResponseMessage(HttpStatusCode.OK));
            Assert.Equal("Successfully logged in", loginFormModel.StatusMessage);
        }
        public async Task LoginSuccessful()
        {
            var loginFormModel = new LoginFormModel();
            var controller = new Controller(loginFormModel);

            controller.Machine.HandleResponseAsync("login", new HttpResponseMessage(HttpStatusCode.OK));
            Assert.Equal("Successfully logged in", loginFormModel.StatusMessage);
        
        }
 public Controller(LoginFormModel model)
 {
     _loginFormModel = model;
     Machine         = new HttpResponseMachine();
     Machine.AddResponseHandler(LoginSuccessful, HttpStatusCode.OK, linkRelation: "login", contentType: null, profile: null);
     Machine.AddResponseHandler(LoginFailed, HttpStatusCode.Unauthorized, linkRelation: "login", contentType: null, profile: null);
     Machine.AddResponseHandler(LoginForbidden, HttpStatusCode.Forbidden, linkRelation: "login", contentType: null, profile: null);
     Machine.AddResponseHandler(FailedRequest, HttpStatusCode.BadRequest, linkRelation: "login", contentType: null, profile: null);
     Machine.AddResponseHandler(ResetForm, HttpStatusCode.OK, linkRelation: "reset", contentType: null, profile: null);
 }
        public Controller(LoginFormModel model)
        {
            _loginFormModel = model;
            Machine = new HttpResponseMachine();
            Machine.AddResponseHandler(LoginSuccessful, HttpStatusCode.OK, linkRelation: "login", contentType: null, profile: null);
            Machine.AddResponseHandler(LoginFailed, HttpStatusCode.Unauthorized, linkRelation: "login", contentType: null, profile: null);
            Machine.AddResponseHandler(LoginForbidden, HttpStatusCode.Forbidden, linkRelation: "login", contentType: null, profile: null);
            Machine.AddResponseHandler(FailedRequest, HttpStatusCode.BadRequest, linkRelation: "login", contentType: null, profile: null);
            Machine.AddResponseHandler(ResetForm, HttpStatusCode.OK, linkRelation: "reset", contentType: null, profile: null);

        }
        public async Task ResetForm()
        {
            var loginFormModel = new LoginFormModel()
            {
                UserName = "******",
                Password = "******"
            };
            var controller = new Controller(loginFormModel);

            controller.Machine.HandleResponseAsync("reset", new HttpResponseMessage(HttpStatusCode.OK));
            Assert.Equal("", loginFormModel.UserName);
            Assert.Equal("", loginFormModel.Password);
        }
        public async Task ResetForm()
        {
            var loginFormModel = new LoginFormModel()
            {
                UserName = "******",
                Password = "******"
            };
            var controller = new Controller(loginFormModel);

            controller.Machine.HandleResponseAsync("reset", new HttpResponseMessage(HttpStatusCode.OK));
            Assert.Equal("", loginFormModel.UserName);
            Assert.Equal("", loginFormModel.Password);
        }
        public async Task LoginFailed()
        {
            var loginFormModel = new LoginFormModel();
            var controller = new Controller(loginFormModel);

            controller.Machine.HandleResponseAsync("login", new HttpResponseMessage(HttpStatusCode.Unauthorized));
            Assert.Equal("Credentials invalid", loginFormModel.StatusMessage);

        }