From 443d1ba40b2727b2f700469dd11914fa194a1dbd Mon Sep 17 00:00:00 2001 From: TheIndra55 Date: Sun, 12 Jan 2025 03:31:58 +0100 Subject: [PATCH] Improve test coverage --- BusinessMonitor.MailTools.Test/BimiTests.cs | 11 +++++++++++ BusinessMonitor.MailTools.Test/DkimTests.cs | 11 +++++++++++ BusinessMonitor.MailTools.Test/DmarcTests.cs | 11 +++++++++++ BusinessMonitor.MailTools/Dkim/DkimCheck.cs | 3 --- BusinessMonitor.MailTools/Spf/SpfCheck.cs | 3 --- 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/BusinessMonitor.MailTools.Test/BimiTests.cs b/BusinessMonitor.MailTools.Test/BimiTests.cs index ca1f305..ba3c815 100644 --- a/BusinessMonitor.MailTools.Test/BimiTests.cs +++ b/BusinessMonitor.MailTools.Test/BimiTests.cs @@ -109,6 +109,17 @@ public void TestInvalidArguments() }); } + [Test] + public void TestNotFound() + { + var check = new BimiCheck(new DummyResolver()); + + Assert.Throws(() => + { + check.GetBimiRecord("example.com"); + }); + } + [Test] public void TestLookups() { diff --git a/BusinessMonitor.MailTools.Test/DkimTests.cs b/BusinessMonitor.MailTools.Test/DkimTests.cs index 6a01b81..aa8cc12 100644 --- a/BusinessMonitor.MailTools.Test/DkimTests.cs +++ b/BusinessMonitor.MailTools.Test/DkimTests.cs @@ -99,6 +99,17 @@ public void TestInvalidArguments() }); } + [Test] + public void TestNotFound() + { + var check = new DkimCheck(new DummyResolver()); + + Assert.Throws(() => + { + check.GetDkimRecord("example.com", "test"); + }); + } + [Test] public void TestRevoked() { diff --git a/BusinessMonitor.MailTools.Test/DmarcTests.cs b/BusinessMonitor.MailTools.Test/DmarcTests.cs index adfb4df..50956fc 100644 --- a/BusinessMonitor.MailTools.Test/DmarcTests.cs +++ b/BusinessMonitor.MailTools.Test/DmarcTests.cs @@ -108,6 +108,17 @@ public void TestInvalidArguments() }); } + [Test] + public void TestNotFound() + { + var check = new DmarcCheck(new DummyResolver()); + + Assert.Throws(() => + { + check.GetDmarcRecord("example.com"); + }); + } + [Test] public void TestLookups() { diff --git a/BusinessMonitor.MailTools/Dkim/DkimCheck.cs b/BusinessMonitor.MailTools/Dkim/DkimCheck.cs index e98425b..c44d340 100644 --- a/BusinessMonitor.MailTools/Dkim/DkimCheck.cs +++ b/BusinessMonitor.MailTools/Dkim/DkimCheck.cs @@ -137,9 +137,6 @@ public static DkimRecord ParseDkimRecord(string value) } break; - - default: - break; } } diff --git a/BusinessMonitor.MailTools/Spf/SpfCheck.cs b/BusinessMonitor.MailTools/Spf/SpfCheck.cs index 922de5b..0e17536 100644 --- a/BusinessMonitor.MailTools/Spf/SpfCheck.cs +++ b/BusinessMonitor.MailTools/Spf/SpfCheck.cs @@ -260,9 +260,6 @@ private static SpfDirective ParseDirective(string qualifier, string mechanism, s directive.Domain = value; break; - - default: - break; } return directive;