public async Task Save(EslrSaverRecord record)
        {
            var builder = new SqlBuilder()
                          .AddEslrSaverTokens(_settings);

            var commandText = builder.Build(EslrSaverDaoResources.Insert);

            await _saveOperation(commandText, CreateParameters(record));
        }
Exemple #2
0
        public void ProviderShouldBeOverridenWhenSpfandDkimFailAndOnBlocklist(DmarcResult spfResult,
                                                                              DmarcResult dkimResult, int blocklistCount, string expectedProvider, string originalProvider)
        {
            AggregateReportRecordEnriched aggregateReportRecordEnriched =
                CreateTestRecord(spfResult, dkimResult, blockListCount: blocklistCount);
            EslrSaverRecord result = aggregateReportRecordEnriched.ToEslrSaverRecord();

            Assert.AreEqual(expectedProvider, result.Provider);
            Assert.AreEqual(originalProvider, result.OriginalProvider);
        }
 private static IDictionary <string, object> CreateParameters(EslrSaverRecord eslr)
 {
     return(new Dictionary <string, object>
     {
         ["record_id"] = eslr.RecordId,
         ["effective_date"] = eslr.EffectiveDate.ToString("yyyy-MM-dd"),
         ["domain"] = eslr.Domain,
         ["reverse_domain"] = eslr.ReverseDomain,
         ["provider"] = eslr.Provider,
         ["original_provider"] = eslr.OriginalProvider,
         ["reporter_org_name"] = eslr.ReporterOrgName,
         ["ip"] = eslr.Ip,
         ["count"] = eslr.Count,
         ["disposition"] = eslr.Disposition,
         ["dkim"] = eslr.Dkim,
         ["spf"] = eslr.Spf,
         ["envelope_to"] = eslr.EnvelopeTo,
         ["envelope_from"] = eslr.EnvelopeFrom,
         ["header_from"] = eslr.HeaderFrom,
         ["organisation_domain_from"] = eslr.OrganisationDomainFrom,
         ["spf_auth_results"] = eslr.SpfAuthResults,
         ["spf_pass_count"] = eslr.SpfPassCount,
         ["spf_fail_count"] = eslr.SpfFailCount,
         ["dkim_auth_results"] = eslr.DkimAuthResults,
         ["dkim_pass_count"] = eslr.DkimPassCount,
         ["dkim_fail_count"] = eslr.DkimFailCount,
         ["forwarded"] = eslr.Forwarded,
         ["sampled_out"] = eslr.SampledOut,
         ["trusted_forwarder"] = eslr.TrustedForwarder,
         ["mailing_list"] = eslr.MailingList,
         ["local_policy"] = eslr.LocalPolicy,
         ["arc"] = eslr.Arc,
         ["other_override_reason"] = eslr.OtherOverrideReason,
         ["host_name"] = eslr.HostName,
         ["host_org_domain"] = eslr.HostOrgDomain,
         ["host_provider"] = eslr.HostProvider,
         ["host_as_number"] = eslr.HostAsNumber,
         ["host_as_description"] = eslr.HostAsDescription,
         ["host_country"] = eslr.HostCountry,
         ["proxy_blocklist"] = eslr.ProxyBlockListCount,
         ["suspicious_network_blocklist"] = eslr.HijackedNetworkBlockListCount,
         ["hijacked_network_blocklist"] = eslr.SuspiciousNetworkBlockListCount,
         ["enduser_network_blocklist"] = eslr.EndUserNetworkBlockListCount,
         ["spam_source_blocklist"] = eslr.SpamSourceBlockListCount,
         ["malware_blocklist"] = eslr.MalwareBlockListCount,
         ["enduser_blocklist"] = eslr.EndUserBlockListCount,
         ["bounce_reflector_blocklist"] = eslr.BounceReflectorBlockListCount
     });
 }