Beispiel #1
0
 public ConfirmEmailAccountTests()
 {
     validator = new ConfirmEmailAccountValidation();
     command   = new ConfirmEmailAccount(
         "id_123",
         "code_123");
 }
 public ConfirmEmailAccountHandlerTests()
 {
     fakeAccountRepository = new Mock <IAccountRepository>();
     fakeAccount           = new Mock <Account>();
     command = new ConfirmEmailAccount(
         "id_123",
         "code_123");
     identityResultSuccess = IdentityResult.Success;
     identityResultFailed  = IdentityResult.Failed();
 }
        public async Task Confirm_email_account_returns_success()
        {
            var fakeCommand = new ConfirmEmailAccount("id_123", "code_123");

            CommandResponse commandResponse = new SuccessCommandResponse();

            var fakeAccountService = new Mock <IAccountAppService>();

            fakeAccountService.Setup(x => x.ConfirmEmail(fakeCommand))
            .Returns(Task.FromResult(commandResponse));

            var accountController = new AccountController(fakeAccountService.Object);

            var requestResult = await accountController.ConfirmEmail(fakeCommand);

            Assert.IsType <OkObjectResult>(requestResult);
        }
        public async Task Confirm_email_account_returns_bad_request()
        {
            var fakeCommand = new ConfirmEmailAccount("id_123", "code_123");

            CommandResponse commandResponse = new ErrorCommandResponse();

            commandResponse.AddNotification(null);

            var fakeAccountService = new Mock <IAccountAppService>();

            fakeAccountService.Setup(x => x.ConfirmEmail(fakeCommand))
            .Returns(Task.FromResult(commandResponse));

            var accountController = new AccountController(fakeAccountService.Object);

            var requestResult = await accountController.ConfirmEmail(fakeCommand);

            Assert.IsType <BadRequestObjectResult>(requestResult);
        }
Beispiel #5
0
 public async Task <CommandResponse> ConfirmEmail(ConfirmEmailAccount command)
 {
     return(await _mediator.Send(command));
 }