This repository has been archived by the owner on Oct 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- To cover the functionality of the get_domain_from_host method
- Loading branch information
Showing
3 changed files
with
129 additions
and
9 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
104 changes: 104 additions & 0 deletions
104
....tests/infrastructure.app/IconUrlNotSameDomainAsProjectUrlDomainorRawGitGuidelineSpecs.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,104 @@ | ||
namespace chocolatey.package.validator.tests.infrastructure.app | ||
{ | ||
using chocolatey.package.validator.infrastructure.app.rules; | ||
using Should; | ||
|
||
public abstract class IconUrlNotSameDomainAsProjectUrlDomainorRawGitGuidelineSpecsBase : TinySpec | ||
{ | ||
protected IconUrlNotSameDomainAsProjectUrlDomainOrRawGitGuideline iconGuideline; | ||
|
||
public override void Context() | ||
{ | ||
iconGuideline = new IconUrlNotSameDomainAsProjectUrlDomainOrRawGitGuideline(); | ||
} | ||
} | ||
|
||
public class when_extracting_domain_from_host : IconUrlNotSameDomainAsProjectUrlDomainorRawGitGuidelineSpecsBase | ||
{ | ||
private string result; | ||
|
||
public override void Because() | ||
{ | ||
} | ||
|
||
[Fact] | ||
public void GetDomainFromHost_should_return_domain_from_only_host_and_single_level_top_level_domain() | ||
{ | ||
Context(); | ||
|
||
var domain = iconGuideline.get_domain_from_host("test.com"); | ||
|
||
domain.ShouldEqual("test.com"); | ||
} | ||
|
||
[Fact] | ||
public void GetDomainFromHost_should_return_domain_from_only_host_and_double_level_top_level_domain() | ||
{ | ||
Context(); | ||
|
||
var domain = iconGuideline.get_domain_from_host("test.co.uk"); | ||
|
||
domain.ShouldEqual("test.co.uk"); | ||
} | ||
|
||
[Fact] | ||
public void GetDomainFromHost_should_return_domain_from_www_subdomain_and_single_level_top_level_domain() | ||
{ | ||
Context(); | ||
|
||
var domain = iconGuideline.get_domain_from_host("www.test.com"); | ||
|
||
domain.ShouldEqual("test.com"); | ||
} | ||
|
||
[Fact] | ||
public void GetDomainFromHost_should_return_domain_from_www_subdomain_and_double_level_top_level_domain() | ||
{ | ||
Context(); | ||
|
||
var domain = iconGuideline.get_domain_from_host("www.test.co.uk"); | ||
|
||
domain.ShouldEqual("test.co.uk"); | ||
} | ||
|
||
[Fact] | ||
public void GetDomainFromHost_should_return_domain_from_arbitrary_subdomain_and_single_level_top_level_domain() | ||
{ | ||
Context(); | ||
|
||
var domain = iconGuideline.get_domain_from_host("somewildsubdomain.test.com"); | ||
|
||
domain.ShouldEqual("test.com"); | ||
} | ||
|
||
[Fact] | ||
public void GetDomainFromHost_should_return_domain_from_arbitrary_subdomain_and_double_level_top_level_domain() | ||
{ | ||
Context(); | ||
|
||
var domain = iconGuideline.get_domain_from_host("somewildsubdomain.test.co.uk"); | ||
|
||
domain.ShouldEqual("test.co.uk"); | ||
} | ||
|
||
[Fact] | ||
public void GetDomainFromHost_should_return_domain_from_three_letter_host_and_single_level_top_level_domain() | ||
{ | ||
Context(); | ||
|
||
var domain = iconGuideline.get_domain_from_host("somewildsubdomain.tla.com"); | ||
|
||
domain.ShouldEqual("tla.com"); | ||
} | ||
|
||
[Fact] | ||
public void GetDomainFromHost_should_return_domain_from_three_letter_host_and_double_level_top_level_domain() | ||
{ | ||
Context(); | ||
|
||
var domain = iconGuideline.get_domain_from_host("somewildsubdomain.tla.co.uk"); | ||
|
||
domain.ShouldEqual("tla.co.uk"); | ||
} | ||
} | ||
} |
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