public static AndConstraint <GenericCollectionAssertions <MimeMessage> > ContainProperLink(this GenericCollectionAssertions <MimeMessage> messages) => messages.SatisfyRespectively( x => { var link = EmailContentExtractor.GetUrlFromActivationMail(x); link.Should().NotBeNullOrWhiteSpace(); } );
public static AndConstraint <GenericCollectionAssertions <MimeMessage> > ContainProperToken(this GenericCollectionAssertions <MimeMessage> messages) => messages.SatisfyRespectively( x => { var token = EmailContentExtractor.GetTokenFromForgotPasswordEmail(x); token.Should().NotBeNullOrWhiteSpace(); } );
internal static async Task <UserDto> LoginAsUser(this ServerFixture fixture, string email, string nickname) { var password = "******"; var identityApi = fixture.GetClient <IIdentityApi>(); await identityApi.SignUp(new SignUpCommand(email, password)); var mailService = (FakeMailService)fixture.GetService <IMailService>(); var link = EmailContentExtractor.GetUrlFromActivationMail(mailService.Messages.Last()); var(userId, token) = EmailContentExtractor.GetQueryParams(link); await identityApi.ActivateAccount(new ActivateCommand(Guid.Parse(userId), token, nickname)); var authDto = await identityApi.SignIn(new SignInCommand(email, password)); return(new UserDto(Guid.Parse(authDto.Subject), nickname, email, authDto.Token)); }