public void PublisherDeterminesStatusAndDispatchesIt() { Message rootMessage = CreateInfoMessage(); Message recordsMessage = CreateInfoMessage(); Message recordsRecordsMessages = CreateInfoMessage(); SpfRecordsEvaluated message = new SpfRecordsEvaluated("testDomain", new SpfRecords(new List <SpfRecord> { new SpfRecord(null, null, null, new List <Message> { recordsRecordsMessages }, false) }, 0, new List <Message> { recordsMessage }), null, null, new List <Message> { rootMessage }, DateTime.MinValue); A.CallTo(() => _domainStatusEvaluator.GetStatus(A <List <Message> > .That.Matches(x => x.Contains(rootMessage) && x.Contains(recordsMessage) && x.Contains(recordsRecordsMessages)))).Returns(Status.Info); _domainStatusPublisher.Publish(message); Expression <Func <DomainStatusEvaluation, bool> > predicate = x => x.Status == Status.Info && x.RecordType == "SPF" && x.Id == "testDomain"; A.CallTo(() => _dispatcher.Dispatch(A <DomainStatusEvaluation> .That.Matches(predicate), "testSnsTopicArn")).MustHaveHappenedOnceExactly(); }
public void StatusIsDeterminedAndDispatched() { Message pollError = CreateMessage(); Message dkimRecordMessage = CreateMessage(); DkimEvaluatorMessage dkimEvaluatorMessage = CreateDkimEvaluatorMessage(); DkimRecordEvaluationResult message = new DkimRecordEvaluationResult("testDomain", new List <DkimSelectorResult> { new DkimSelectorResult( new DkimSelector("", new List <DkimRecord> { new DkimRecord(null, new List <Message> { dkimRecordMessage }) }, "", pollError), new List <RecordResult> { new RecordResult("", new List <DkimEvaluatorMessage> { dkimEvaluatorMessage }) }) }); A.CallTo(() => _domainStatusEvaluator.GetStatus(A <List <DkimEvaluatorMessage> > .That.Matches(x => x.Contains(dkimEvaluatorMessage)), A <List <Message> > .That.Matches(x => x.Contains(pollError) && x.Contains(dkimRecordMessage)))).Returns(Status.Warning); _domainStatusPublisher.Publish(message); Expression <Func <DomainStatusEvaluation, bool> > predicate = x => x.Status == Status.Warning && x.RecordType == "DKIM" && x.Id == "testDomain"; A.CallTo(() => _dispatcher.Dispatch(A <DomainStatusEvaluation> .That.Matches(predicate), "testSnsTopicArn")).MustHaveHappenedOnceExactly(); }