-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
237 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ public sealed class ComplexTest | |
public void TryParse_ValidDmarcString1_ReturnsTrueAndPopulatesDmarcRecord() | ||
{ | ||
var isSuccessful = DmarcRecordParser.TryParse("v=DMARC1; p=reject; rua=mailto:[email protected], mailto:[email protected]; pct=100; adkim=s; aspf=s", out var dmarcDataFragment, out var parseErrors); | ||
|
||
Assert.IsTrue(isSuccessful); | ||
Assert.IsNotNull(dmarcDataFragment); | ||
Assert.AreEqual("reject", dmarcDataFragment.DomainPolicy); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/Nager.EmailAuthentication.UnitTest/DmarcRecordParserTests/ReportingIntervalTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
namespace Nager.EmailAuthentication.UnitTest.DmarcRecordParserTests | ||
{ | ||
[TestClass] | ||
public sealed class ReportingIntervalTest | ||
{ | ||
[TestMethod] | ||
public void TryParse_ValidDmarcString1_ReturnsTrueAndPopulatesDmarcRecord() | ||
{ | ||
var isSuccessful = DmarcRecordParser.TryParse("v=DMARC1; p=reject; ri=86400;", out var dmarcDataFragment, out var parseErrors); | ||
|
||
Assert.IsTrue(isSuccessful); | ||
Assert.IsNotNull(dmarcDataFragment); | ||
Assert.AreEqual("reject", dmarcDataFragment.DomainPolicy); | ||
Assert.AreEqual("86400", dmarcDataFragment.ReportingInterval); | ||
Assert.IsNull(parseErrors, "ParseErrors is not null"); | ||
} | ||
|
||
[TestMethod] | ||
public void TryParse_InvalidDmarcString1_ReturnsTrueWithErrors() | ||
{ | ||
var isSuccessful = DmarcRecordParser.TryParse("v=DMARC1; p=reject; ri=1000;", out var dmarcDataFragment, out var parseErrors); | ||
|
||
Assert.IsTrue(isSuccessful); | ||
Assert.IsNotNull(dmarcDataFragment); | ||
Assert.AreEqual("reject", dmarcDataFragment.DomainPolicy); | ||
Assert.AreEqual("1000", dmarcDataFragment.ReportingInterval); | ||
Assert.IsNotNull(parseErrors, "ParseErrors is null"); | ||
Assert.IsTrue(parseErrors.Length == 1); | ||
} | ||
|
||
[TestMethod] | ||
public void TryParse_InvalidDmarcString2_ReturnsTrueWithErrors() | ||
{ | ||
var isSuccessful = DmarcRecordParser.TryParse("v=DMARC1; p=reject; ri=1000000;", out var dmarcDataFragment, out var parseErrors); | ||
|
||
Assert.IsTrue(isSuccessful); | ||
Assert.IsNotNull(dmarcDataFragment); | ||
Assert.AreEqual("reject", dmarcDataFragment.DomainPolicy); | ||
Assert.AreEqual("1000000", dmarcDataFragment.ReportingInterval); | ||
Assert.IsNotNull(parseErrors, "ParseErrors is null"); | ||
Assert.IsTrue(parseErrors.Length == 1); | ||
} | ||
|
||
[TestMethod] | ||
public void TryParse_InvalidDmarcString3_ReturnsTrueWithErrors() | ||
{ | ||
var isSuccessful = DmarcRecordParser.TryParse("v=DMARC1; p=reject; ri=-1000000;", out var dmarcDataFragment, out var parseErrors); | ||
|
||
Assert.IsTrue(isSuccessful); | ||
Assert.IsNotNull(dmarcDataFragment); | ||
Assert.AreEqual("reject", dmarcDataFragment.DomainPolicy); | ||
Assert.AreEqual("-1000000", dmarcDataFragment.ReportingInterval); | ||
Assert.IsNotNull(parseErrors, "ParseErrors is null"); | ||
Assert.IsTrue(parseErrors.Length == 1); | ||
} | ||
} | ||
} |
Oops, something went wrong.