public async Task ReturnsExceptionMessageGivenInactiveInviteCode()
        {
            Invitation _invitation = new Invitation(_email, _inviteCode, _subscriptionId);

            _invitation.Deactivate();

            _repository.Setup(r => r.GetAsync(It.IsAny <InvitationByInviteCodeSpec>())).ReturnsAsync(_invitation);

            var result = await _newMemberService.VerifyValidEmailAndInviteCodeAsync(_email, _inviteCode);

            _repository.Verify(r => r.GetAsync(It.IsAny <InvitationByInviteCodeSpec>()), Times.Once);
            Assert.Equal(_inactiveInviteString, result.Value);
        }
Exemplo n.º 2
0
    private async Task DeactivateInviteAndDuplicates(Invitation invite)
    {
        invite.Deactivate();
        await _invitationRepository.UpdateAsync(invite);

        var activeInviteSpec          = new ActiveInvitationByEmailSpec(invite.Email);
        var moreActiveInvitesForEmail = await _invitationRepository.ListAsync(activeInviteSpec);

        if (moreActiveInvitesForEmail.Any())
        {
            _logger.LogInformation($"User {invite.Email} had multiple active invites.");
        }
        foreach (var extraInvite in moreActiveInvitesForEmail)
        {
            extraInvite.Deactivate();
        }
        await _invitationRepository.SaveChangesAsync();
    }
Exemplo n.º 3
0
 public InvitationBuilder AndDeactivated()
 {
     _invitation.Deactivate();
     return(this);
 }