public static ConfirmPasswordResetCommand NewCommand(PasswordResetConfirmationData data) { return(new ConfirmPasswordResetCommand( data.UserId, data.Token, ValidPassword.Parse(data.NewPassword))); }
public async Task WhenPostingUserRegistration_ItShouldIssueRegisterUserCommand() { var registration = NewRegistrationData(); var command = new RegisterUserCommand( UserId, registration.ExampleWork, ValidEmail.Parse(registration.Email), ValidUsername.Parse(registration.Username), ValidPassword.Parse(registration.Password), false); this.guidCreator.Setup(_ => _.CreateSqlSequential()).Returns(UserId.Value); this.registerUser.Setup(v => v.HandleAsync(command)).Returns(Task.FromResult(0)); var result = await this.controller.PostRegistrationAsync(registration); Assert.IsInstanceOfType(result, typeof(OkResult)); this.registerUser.Verify(v => v.HandleAsync(command)); this.guidCreator.Verify(v => v.CreateSqlSequential()); }