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();
        }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 5
0
        public void ItReturnsAnIActionResult()
        {
            // Arrange
            var controller = new LogonController(_logonService);

            // Act
            var response = controller.Post(null);

            // Assert
            Assert.IsAssignableFrom <IActionResult>(response);
        }
Esempio n. 6
0
        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;
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        private static LogonController GetController()
        {
            var controller = new LogonController(new LogonService(new FakeRepository <UserLogonDto>()));

            return(controller);
        }
Esempio n. 11
0
 public void Setup()
 {
     _logonController = new LogonController();
 }