Ejemplo n.º 1
0
        public void IndexGet_with_invalid_centreId_param_shows_error()
        {
            // Given
            const int centreId = 7;

            A.CallTo(() => centresDataService.GetCentreName(centreId)).Returns(null);

            // When
            var result = controller.Index(centreId);

            // Then
            A.CallTo(() => centresDataService.GetCentreName(centreId)).MustHaveHappened(1, Times.Exactly);
            result.Should().BeNotFoundResult();
        }
Ejemplo n.º 2
0
        public IActionResult Index(int?centreId = null)
        {
            if (User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (!centreId.HasValue || centresDataService.GetCentreName(centreId.Value) == null)
            {
                return(NotFound());
            }

            if (!IsRegisterAdminAllowed(centreId.Value))
            {
                return(RedirectToAction("AccessDenied", "LearningSolutions"));
            }

            SetAdminRegistrationData(centreId.Value);

            return(RedirectToAction("PersonalInformation"));
        }
Ejemplo n.º 3
0
 private bool CheckCentreIdValid(int?centreId)
 {
     return(centreId == null ||
            centresDataService.GetCentreName(centreId.Value) != null);
 }