public async Task ValidCommandFromAccountOwnerCreatesInvitation() { //Act await _handler.Handle(_command); //Assert _invitationRepository.Verify(x => x.Create(It.Is <Invitation>(m => m.AccountId == ExpectedAccountId && m.Email == _command.Email && m.Name == _command.Name && m.Status == InvitationStatus.Pending && m.RoleId == _command.RoleId && m.ExpiryDate == DateTimeProvider.Current.UtcNow.Date.AddDays(8))), Times.Once); }
public async Task Then_InvitedUserEventPublishedWithCorrectPersonInvited() { //Act await _handler.Handle(_command); _endpoint.Verify(e => e.Publish(It.Is <InvitedUserEvent>(i => i.PersonInvited == NameOfPersonBeingInvited))); }
public async Task HandleCreateInvitationCommand_ShouldAddInvitationToRepository() { await _dut.Handle(_command, default); Assert.IsNotNull(_createdInvitation); _unitOfWorkMock.Verify(t => t.SaveChangesAsync(It.IsAny <CancellationToken>()), Times.Exactly(2)); }