private void InsertAndRead(IEvent @event) { _eventToPublishRepository.Add(@event); _eventToPublishRepository.UnitOfWork.Commit(); var eventToPublish = _eventToPublishRepository.Read(@event.Id); _retrievedEvent = _eventToPublishSerializer.Deserialize(eventToPublish); }
public void Add(IEvent @event) { // This is all a bit smoke-and-mirrors, but I can't think of a better way to do this without having to change to the OutboxEventPublisher / EventToPublishRepository // *specifically* for testing purposes, which always feels wrong. At least this way, the extra complication is contained within the tests, and not the // system-under-test. OnBeforeAdding(@event); _eventToPublishRepository.Add(@event); OnAfterAdding(@event); }