public AggregateReportRecordEnriched Create(IpAddressDetails response, AggregateReportRecord source, string orgDomain, string correlationId, string causationId) { return(new AggregateReportRecordEnriched( Guid.NewGuid().ToString(), source.Id, correlationId, causationId, source.ReporterOrgName, source.ReportId, source.EffectiveDate, source.DomainFrom, source.Adkim, source.Aspf, source.P, source.Sp, source.Pct, source.Fo, source.HostSourceIp, source.Count, source.Disposition, source.Dkim, source.Spf, source.EnvelopeTo, source.EnvelopeFrom, source.HeaderFrom, orgDomain, source.SpfAuthResults, source.SpfPassCount, source.SpfFailCount, source.DkimAuthResults, source.DkimPassCount, source.DkimFailCount, source.Forwarded, source.SampledOut, source.TrustedForwarder, source.MailingList, source.LocalPolicy, source.Arc, source.OtherOverrideReason, response?.ReverseDnsResponses != null && response.ReverseDnsResponses.Any() ? response.ReverseDnsResponses.OrderBy(x => x.Host).First().Host : "", response?.ReverseDnsResponses != null && response.ReverseDnsResponses.Any() ? response.ReverseDnsResponses.OrderBy(x => x.Host).First().OrganisationalDomain : "", _providerResolver.GetProvider(response), response?.AsNumber ?? 0, response?.Description, response?.CountryCode, response?.BlockListOccurrences?.Count(x => x.Flag == "proxy") ?? 0, response?.BlockListOccurrences?.Count(x => x.Flag == "suspiciousnetwork") ?? 0, response?.BlockListOccurrences?.Count(x => x.Flag == "highjackednetwork") ?? 0, response?.BlockListOccurrences?.Count(x => x.Flag == "endusernetwork") ?? 0, response?.BlockListOccurrences?.Count(x => x.Flag == "spamsource") ?? 0, response?.BlockListOccurrences?.Count(x => x.Flag == "malware") ?? 0, response?.BlockListOccurrences?.Count(x => x.Flag == "enduser") ?? 0, response?.BlockListOccurrences?.Count(x => x.Flag == "bouncereflector") ?? 0)); }
public void BlocklistFlagsSetCorrectly(string flagName, string countField) { IpAddressDetails response = CreateResponse(); response.BlockListOccurrences.Add(new BlocklistAppearance(flagName, "source", "description")); AggregateReportRecord source = CreateSource(); AggregateReportRecordEnriched result = _aggregateReportRecordEnrichedFactory.Create(response, source, "", "", ""); Assert.AreEqual(1, typeof(AggregateReportRecordEnriched).GetProperty(countField)?.GetValue(result, null)); }