protected override void OnViewControlsCreated() { LogonController logonController = Frame.GetController <LogonController>(); if (logonController != null) { SetActionsActive(logonController.AcceptAction.Active); } IList <string> providersName = GetProviderNames() as IList <string>; if (providersName.Count == 0) { RegisterVisibleUserExistingTextScript(false); } googleAction.Active["ProviderIsSet"] = providersName.Contains("Google"); facebookAction.Active["ProviderIsSet"] = providersName.Contains("Facebook"); microsoftAction.Active["ProviderIsSet"] = providersName.Contains("Microsoft"); if (IsOAuthRequest && WebWindow.CurrentRequestPage != null) { WebWindow.CurrentRequestPage.Load += CurrentRequestPage_Load; } base.OnViewControlsCreated(); }
public void ItExists() { // Arrange var controller = new LogonController(_logonService); // Act var response = controller.Post(null); }
protected override void OnActivated() { base.OnActivated(); LogonController logonController = Frame.GetController <LogonController>(); if (logonController != null) { logonController.AcceptAction.Changed += AcceptAction_Changed; } }
private void CurrentRequestPage_Load(object sender, System.EventArgs e) { ((Page)sender).Load -= CurrentRequestPage_Load; LogonController logonController = Frame.GetController <LogonController>(); if (logonController != null && logonController.AcceptAction.Active) { logonController.AcceptAction.DoExecute(); } }
public void ItReturnsAnIActionResult() { // Arrange var controller = new LogonController(_logonService); // Act var response = controller.Post(null); // Assert Assert.IsAssignableFrom <IActionResult>(response); }
protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); bool isLogonParametersActionView = (View != null) && (View.ObjectTypeInfo != null) && View.ObjectTypeInfo.Implements <LogonActionParametersBase>(); LogonController lc = Frame.GetController <LogonController>(); if (lc != null) { lc.AcceptAction.Active[LogonActionParametersActiveKey] = !isLogonParametersActionView; lc.CancelAction.Active[LogonActionParametersActiveKey] = !isLogonParametersActionView; } AcceptLogonParametersAction.Active[LogonActionParametersActiveKey] = isLogonParametersActionView; CancelLogonParametersAction.Active[LogonActionParametersActiveKey] = isLogonParametersActionView; }
public void ItReturnsSuccessfulLogonMessageWhenSuccessful() { // Arrange var controller = new LogonController(_logonService); var attempt = new LoginAttempt { Username = "******", Password = "******" }; // Act var response = (ObjectResult)controller.Post(attempt); // Assert Assert.Equal("Logon Successful", response.Value); }
public void ItReturnsUnauthorizedLogonMessageWhenUnauthorized() { // Arrange var controller = new LogonController(_logonService); var attempt = new LoginAttempt { Username = "******", Password = "******" }; // Act var response = (ObjectResult)controller.Post(attempt); // Assert Assert.Equal("Username or Password invalid", response.Value); }
public void ItReturnsUnauthorizedForInvalidPassword() { // Arrange var controller = new LogonController(_logonService); var attempt = new LoginAttempt { Username = "******", Password = "******" }; // Act var response = (ObjectResult)controller.Post(attempt); // Assert Assert.NotNull(response.StatusCode); Assert.Equal(HttpStatusCode.Unauthorized, (HttpStatusCode)response.StatusCode); }
private static LogonController GetController() { var controller = new LogonController(new LogonService(new FakeRepository <UserLogonDto>())); return(controller); }
public void Setup() { _logonController = new LogonController(); }