public async Task UserRegistrationIsPersisted() { var email = "email"; var passwordHash = "passwordHash"; var userId = await UserRegistrationService.RegisterUser(email, passwordHash); var events = await EventRepository.Get <User>(userId); Assert.IsTrue(events.Exists <UserRegisteredEvent>(@event => @event.Email == email && @event.PasswordHash == passwordHash)); }
static async Task <int> Add(AddOptions options) { try { await UserRegistrationCommandService.RegisterUser(options.Email, options.Password.ToSecureString()); } catch (Exception e) { Console.Error.WriteLine(e.Message); } return(0); }
public async Task GetUserByPartialEmail() { var email = "email"; var emailQuery = "EMa"; var passwordHash = "passwordHash"; var resultsBefore = await UserRegistrationQueryService.SearchUser(emailQuery); Assert.IsFalse(resultsBefore.Contains(email)); await UserRegistrationCommandService.RegisterUser(email, passwordHash); var userId = await UserRegistrationQueryService.GetUserId(email); await UserRegistrationCommandService.EmailVerified(userId, email); var resultsAfter = await UserRegistrationQueryService.SearchUser(emailQuery); Assert.IsTrue(resultsAfter.Contains(email)); }