public async Task HandleDomainCreatedCreatesDomain() { A.CallTo(() => _spfHistoryEntityDao.Get(Id)).Returns <SpfHistoryEntityState>(null); await _spfEntityHistory.Handle(new DomainCreated(Id, "*****@*****.**", DateTime.Now)); A.CallTo(() => _spfHistoryEntityDao.Save(A <SpfHistoryEntityState> ._)).MustHaveHappenedOnceExactly(); }
public async Task Handle(DomainCreated message) { string messageId = message.Id.ToLower(); SpfHistoryEntityState state = await _dao.Get(messageId); if (state == null) { state = new SpfHistoryEntityState(messageId); await _dao.Save(state); _log.LogInformation("Created SpfEntityHistory for {Id}.", messageId); } else { _log.LogWarning("Ignoring {EventName} as SpfEntityHistory already exists for {Id}.", nameof(DomainCreated), messageId); ; } }
public async Task GetNoStateExistsReturnsNull() { SpfHistoryEntityState state = await _dao.Get(Id); Assert.That(state, Is.Null); }