public void ProviderShouldBeOverridenWhenSpfandDkimFailAndOnBlocklist(DmarcResult spfResult, DmarcResult dkimResult, int blocklistCount, string expectedProvider)
        {
            AggregateReportRecordEnriched            aggregateReportRecordEnriched = CreateTestRecord(spfResult, dkimResult, blockListCount: blocklistCount);
            List <DomainDateProviderSubdomainRecord> result = aggregateReportRecordEnriched.ToDomainDateProviderSubdomainRecord();

            Assert.AreEqual(expectedProvider, result[0].Provider);
        }
        public void ConvertingToRecordShouldTallyCorrectly(DmarcResult?spfResult, DmarcResult?dkimResult, Policy?disposition, string aggregationField)
        {
            AggregateReportRecordEnriched aggregateReportRecordEnriched = CreateTestRecord(spfResult, dkimResult, disposition, 10000);

            List <DomainDateProviderSubdomainRecord> result = aggregateReportRecordEnriched.ToDomainDateProviderSubdomainRecord();

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

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

            List <DomainDateProviderSubdomainRecord> result = aggregateReportRecordEnriched.ToDomainDateProviderSubdomainRecord();

            Assert.AreEqual(8, result.Count);

            // Provider
            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("a.b.c.d.e.gov.uk", result[0].Subdomain);
            Assert.AreEqual("b.c.d.e.gov.uk", result[1].Subdomain);
            Assert.AreEqual("c.d.e.gov.uk", result[2].Subdomain);
            Assert.AreEqual("d.e.gov.uk", result[3].Subdomain);

            Assert.AreEqual("b.c.d.e.gov.uk", result[0].Domain);
            Assert.AreEqual("c.d.e.gov.uk", result[1].Domain);
            Assert.AreEqual("d.e.gov.uk", result[2].Domain);
            Assert.AreEqual("e.gov.uk", result[3].Domain);

            // All Providers
            Assert.AreEqual("All Providers", 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("a.b.c.d.e.gov.uk", result[4].Subdomain);
            Assert.AreEqual("b.c.d.e.gov.uk", result[5].Subdomain);
            Assert.AreEqual("c.d.e.gov.uk", result[6].Subdomain);
            Assert.AreEqual("d.e.gov.uk", result[7].Subdomain);

            Assert.AreEqual("b.c.d.e.gov.uk", result[4].Domain);
            Assert.AreEqual("c.d.e.gov.uk", result[5].Domain);
            Assert.AreEqual("d.e.gov.uk", result[6].Domain);
            Assert.AreEqual("e.gov.uk", result[7].Domain);
        }