Exemple #1
0
        private static Task <IActionResult> CriaControllerEUtilizaAService(
            string fullName = null, string email = null, string password = null, string confirmPassword = null, string token = null)
        {
            var fakeContext = new FakeContext("AccountManagerControllerTests");
            var fakeService = fakeContext.FakeAuthenticationRepository().Object;
            var controller  = new AuthenticationController();

            if (confirmPassword != null)
            {
                var registerCreateDTO = new RegisterCreateDTO
                {
                    FullName        = fullName,
                    Email           = email,
                    Password        = password,
                    ConfirmPassword = confirmPassword
                };
                return(controller.Register(fakeService, registerCreateDTO));
            }
            else if (token != null)
            {
                return(controller.ConfirmEmail(fakeService, fakeContext._configuration, email, token));
            }
            else if (password != null && confirmPassword == null)
            {
                var loginCreateDTO = new LoginCreateDTO
                {
                    Email    = email,
                    Password = password
                };
                return(controller.SignIn(fakeService, loginCreateDTO));
            }
            else
            {
                var forgotPasswordDTO = new ForgotPasswordDTO
                {
                    Email = email
                };
                return(controller.ForgotPassword(fakeService, forgotPasswordDTO));
            }
        }