-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from merijndejonge/AddGetRules
Add extension method to retrieve the collection of rules from a struc…
- Loading branch information
Showing
3 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/Nager.PublicSuffix.UnitTest/DomainDataStructureExtensionsTests.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,30 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Nager.PublicSuffix.Extensions; | ||
using Nager.PublicSuffix.Models; | ||
using System.Linq; | ||
|
||
namespace Nager.PublicSuffix.UnitTest; | ||
|
||
[TestClass] | ||
public class DomainDataStructureExtensionsTests | ||
{ | ||
[TestMethod] | ||
public void GetRulesTest() | ||
{ | ||
var structure = new DomainDataStructure(""); | ||
var rulesIn = new[] | ||
{ | ||
new TldRule("foo", TldRuleDivision.Private), | ||
new TldRule("bar", TldRuleDivision.Private ), | ||
new TldRule("to.gov.br", TldRuleDivision.ICANN), | ||
new TldRule("*.bd", TldRuleDivision.ICANN), | ||
new TldRule("un.known", TldRuleDivision.Unknown) | ||
}; | ||
|
||
structure.AddRules(rulesIn); | ||
|
||
var rulesOut = structure.GetRules().ToArray(); | ||
|
||
CollectionAssert.AreEqual(rulesIn, rulesOut); | ||
} | ||
} |
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