public async Task <Lock> TryCreateAsync(Lock @lock, string userId) { var entity = await _locksRepository.TryCreateAsync(@lock, userId).ConfigureAwait(false); if (entity != null) { await _eventPublisher.SendLockCreatedMessageAsync(entity, userId).ConfigureAwait(false); } return(entity); }
public async Task CreateAsync_NotNullModel_LockCreated() { // Arrage var @lock = _fixure.Create <Locks.Entities.Lock>(); // Act var result = await _repository.TryCreateAsync(@lock, _userId); // Assert result.Should().BeEquivalentTo(@lock, opt => opt .Excluding(x => x.CreatedBy)); }