public async Task PublishesDomainMissingMessageWhenDomainDoesNotExist() { A.CallTo(() => _dao.GetSpfForDomain("testDomain")) .Returns(Task.FromResult <SpfInfoResponse>(null)); SpfInfoResponse result = await _spfService.GetSpfForDomain("testDomain"); A.CallTo(() => _messagePublisher.Publish(A <DomainMissing> ._, A <string> ._)) .MustHaveHappenedOnceExactly(); Assert.AreEqual(null, result); }
public async Task <SpfInfoResponse> GetSpfForDomain(string requestDomain) { SpfInfoResponse response = await _dao.GetSpfForDomain(requestDomain); if (response is null) { await _messagePublisher.Publish(new DomainMissing(requestDomain), _config.MicroserviceOutputSnsTopicArn); } return(response); }