public async Task DkimSchedulerItemDoesntExistDkimSchedulerItemIsCreatedOnDkimEntityCreatedMessage() { A.CallTo(() => _dao.Get(A <string> ._)) .Returns((DkimSchedulerState)null); DkimEntityCreated message = new DkimEntityCreated("Domain", 1); await _handler.Handle(message); A.CallTo(() => _dao.Save(A <DkimSchedulerState> ._)).MustHaveHappenedOnceExactly(); }
public async Task InsertRecordTest() { DkimSchedulerState record = new DkimSchedulerState("abc.com"); await _dkimSchedulerDao.Save(record); List <DkimSchedulerState> results = await GetValues(); Assert.That(results.Count, Is.EqualTo(1)); Assert.That(results.First().Id, Is.EqualTo(record.Id)); }
public async Task Handle(DkimEntityCreated message) { string domain = message.Id.ToLower(); DkimSchedulerState state = await _dkimSchedulerDao.Get(domain); if (state == null) { state = new DkimSchedulerState(domain); await _dkimSchedulerDao.Save(state); _log.LogInformation($"{domain} added to DkimScheduler"); } else { _log.LogInformation($"{domain} already exists in DkimScheduler"); } }