コード例 #1
0
        public void SignUpAction_Returns_View()
        {
            //Act
            var controller = new CharityController(_charityRepository, _notificationService);
            var result     = controller.SignUp();

            //Assert
            result.AssertViewRendered();
        }
コード例 #2
0
        public void SignUpAction_Post_Redirects()
        {
            //Arrange
            var model = new SignUpViewModel();

            _charityRepository.Save(new Charity());
            _notificationService.SendNotification(string.Empty, VolunteerNotificationTemplate.WelcomeVolunteer).Returns(true);

            //Act
            var controller = new CharityController(_charityRepository, _notificationService);
            var result     = controller.SignUp(model);

            //Assert
            result.AssertActionRedirect();
        }
コード例 #3
0
        public void SignUpAction_Post__With_ModelError_Returns_View()
        {
            //Arrange
            var model = new SignUpViewModel();

            _charityRepository.Save(new Charity());
            _notificationService.SendNotification(string.Empty, VolunteerNotificationTemplate.WelcomeVolunteer).Returns(true);

            //Act
            var controller = new CharityController(_charityRepository, _notificationService);

            controller.ModelState.AddModelError("An Error", "Message");
            var result = controller.SignUp(model);

            //Assert
            result.AssertViewRendered();
        }