public void ProviderShouldBeOverridenWhenSpfandDkimFailAndOnBlocklist(DmarcResult spfResult, DmarcResult dkimResult, int blocklistCount, string expectedProvider)
        {
            AggregateReportRecordEnriched aggregateReportRecordEnriched = CreateTestRecord(spfResult, dkimResult, blockListCount: blocklistCount);
            var result = aggregateReportRecordEnriched.ToDomainDateProviderRecord();

            Assert.AreEqual(expectedProvider, result[0].Provider);
        }
示例#2
0
        public void ConvertingToRecordsShouldSplitIntoSubdomainsAndAddAllProvider()
        {
            AggregateReportRecordEnriched aggregateReportRecordEnriched = CreateTestRecord(headerFrom: "a.b.c.d.e.gov.uk", organisationDomain: "e.gov.uk");

            List <DomainDateProviderRecord> result = aggregateReportRecordEnriched.ToDomainDateProviderRecord();

            Assert.AreEqual(10, result.Count);

            Assert.AreEqual("hostProvider", result[0].Provider);
            Assert.AreEqual("hostProvider", result[1].Provider);
            Assert.AreEqual("hostProvider", result[2].Provider);
            Assert.AreEqual("hostProvider", result[3].Provider);
            Assert.AreEqual("hostProvider", result[4].Provider);
            Assert.AreEqual("All Providers", result[5].Provider);
            Assert.AreEqual("All Providers", result[6].Provider);
            Assert.AreEqual("All Providers", result[7].Provider);
            Assert.AreEqual("All Providers", result[8].Provider);
            Assert.AreEqual("All Providers", result[9].Provider);

            Assert.AreEqual("a.b.c.d.e.gov.uk", result[0].Domain);
            Assert.AreEqual("b.c.d.e.gov.uk", result[1].Domain);
            Assert.AreEqual("c.d.e.gov.uk", result[2].Domain);
            Assert.AreEqual("d.e.gov.uk", result[3].Domain);
            Assert.AreEqual("e.gov.uk", result[4].Domain);
            Assert.AreEqual("a.b.c.d.e.gov.uk", result[5].Domain);
            Assert.AreEqual("b.c.d.e.gov.uk", result[6].Domain);
            Assert.AreEqual("c.d.e.gov.uk", result[7].Domain);
            Assert.AreEqual("d.e.gov.uk", result[8].Domain);
            Assert.AreEqual("e.gov.uk", result[9].Domain);
        }
示例#3
0
        public void ConvertingToRecordShouldTallyCorrectly(DmarcResult?spfResult, DmarcResult?dkimResult, Policy?disposition, string aggregationField)
        {
            AggregateReportRecordEnriched aggregateReportRecordEnriched = CreateTestRecord(spfResult, dkimResult, disposition, 10000);

            List <DomainDateProviderRecord> result = aggregateReportRecordEnriched.ToDomainDateProviderRecord();

            Assert.AreEqual(4, result.Count);

            Assert.AreEqual("hostProvider", result[0].Provider);
            Assert.AreEqual("digital.ncsc.gov.uk", result[0].Domain);
            Assert.AreEqual(10000, TallyAllCounts(result[0]));
            Assert.AreEqual(10000, typeof(DomainDateProviderRecord).GetProperty(aggregationField)?.GetValue(result[0], null));

            Assert.AreEqual("hostProvider", result[1].Provider);
            Assert.AreEqual("ncsc.gov.uk", result[1].Domain);
            Assert.AreEqual(10000, TallyAllCounts(result[1]));
            Assert.AreEqual(10000, typeof(DomainDateProviderRecord).GetProperty(aggregationField)?.GetValue(result[0], null));

            Assert.AreEqual("All Providers", result[2].Provider);
            Assert.AreEqual("digital.ncsc.gov.uk", result[2].Domain);
            Assert.AreEqual(10000, TallyAllCounts(result[2]));
            Assert.AreEqual(10000, typeof(DomainDateProviderRecord).GetProperty(aggregationField)?.GetValue(result[1], null));

            Assert.AreEqual("All Providers", result[3].Provider);
            Assert.AreEqual("ncsc.gov.uk", result[3].Domain);
            Assert.AreEqual(10000, TallyAllCounts(result[3]));
            Assert.AreEqual(10000, typeof(DomainDateProviderRecord).GetProperty(aggregationField)?.GetValue(result[1], null));
        }
        public void ConvertingToRecordsShouldCreateAllProvidersRecord()
        {
            AggregateReportRecordEnriched aggregateReportRecordEnriched = CreateTestRecord(headerFrom: "a.b.c.d.e.gov.uk", organisationDomain: "e.gov.uk");

            List <DomainDateProviderRecord> result = aggregateReportRecordEnriched.ToDomainDateProviderRecord();

            Assert.AreEqual(2, result.Count);

            Assert.AreEqual("hostProvider", result[0].Provider);
            Assert.AreEqual("a.b.c.d.e.gov.uk", result[0].Domain);

            Assert.AreEqual("All Providers", result[1].Provider);
            Assert.AreEqual("a.b.c.d.e.gov.uk", result[1].Domain);
        }