-
Notifications
You must be signed in to change notification settings - Fork 1
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 #1196 from cabinetoffice/DP-1060-PPON-Consortium-Code
DP-1060 - PPON - Consortium Code
- Loading branch information
Showing
10 changed files
with
45 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
17 changes: 15 additions & 2 deletions
17
Services/CO.CDP.EntityVerification.Tests/Ppon/PponServiceTests.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 |
---|---|---|
@@ -1,18 +1,31 @@ | ||
using CO.CDP.EntityVerification.Ppon; | ||
using CO.CDP.OrganisationInformation; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace CO.CDP.EntityVerification.Tests.Ppon; | ||
|
||
public class PponServiceTests | ||
{ | ||
[Fact] | ||
public void GeneratePponId_CreatesNewPponId_ReturnsPponIdWithValidLength() | ||
public void GeneratePponId_CreatesNewPponIdForNonConsortium_ReturnsPponIdWithValidLength() | ||
{ | ||
PponService ppon = new PponService(); | ||
string pponId = ppon.GeneratePponId(); | ||
string pponId = ppon.GeneratePponId(OrganisationType.Organisation); | ||
string pattern = @"^P[A-Z]{3}-\d{4}-[A-Z]{4}$"; | ||
bool isMatch = Regex.IsMatch(pponId, pattern); | ||
|
||
Assert.True(isMatch); | ||
} | ||
|
||
[Fact] | ||
public void GeneratePponId_CreatesNewPponIdForConsortium_ReturnsPponIdWithValidLengthWithLastCharAsC() | ||
{ | ||
PponService ppon = new PponService(); | ||
string pponId = ppon.GeneratePponId(OrganisationType.InformalConsortium); | ||
string pattern = @"^P[A-Z]{3}-\d{4}-[A-Z]{3}C$"; | ||
bool isMatch = Regex.IsMatch(pponId, pattern); | ||
|
||
Assert.True(isMatch); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
using CO.CDP.OrganisationInformation; | ||
|
||
namespace CO.CDP.EntityVerification.Ppon; | ||
|
||
public interface IPponService | ||
{ | ||
string GeneratePponId(); | ||
string GeneratePponId(OrganisationType type); | ||
} |
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
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