|
1 | 1 | namespace DigitalLearningSolutions.Web.Tests.Helpers |
2 | 2 | { |
3 | | - using System.Linq; |
4 | 3 | using DigitalLearningSolutions.Web.Helpers; |
| 4 | + using DigitalLearningSolutions.Web.Tests.TestHelpers; |
5 | 5 | using FluentAssertions; |
6 | 6 | using FluentAssertions.Execution; |
7 | 7 | using Microsoft.AspNetCore.Mvc.ModelBinding; |
8 | 8 | using NUnit.Framework; |
| 9 | + using System.Linq; |
9 | 10 |
|
10 | 11 | public class ProfessionalRegistrationNumberHelperTests |
11 | 12 | { |
@@ -104,37 +105,13 @@ public void ValidateProfessionalRegistrationNumber_sets_error_when_hasPrn_is_not |
104 | 105 | } |
105 | 106 | } |
106 | 107 |
|
107 | | - [TestCase(null, "Enter a professional registration number")] |
108 | | - [TestCase("", "Enter a professional registration number")] |
109 | | - [TestCase("1234", "Professional registration number must be between 5 and 20 characters")] |
110 | | - [TestCase("1234", "Professional registration number must be between 5 and 20 characters")] |
111 | | - [TestCase( |
112 | | - "01234_", |
113 | | - "Invalid professional registration number format. " + |
114 | | - "Valid formats include: 7 digits (e.g., 1234567), 1–2 letters followed by 6 digits (e.g., AB123456), " + |
115 | | - "4–8 digits, an optional 'P' plus 5–6 digits, 'C' or 'P' plus 6 digits, " + |
116 | | - "an optional letter plus 5–6 digits, 'L' plus 4–6 digits, " + |
117 | | - "or 2 digits followed by a hyphen and 4–5 alphanumeric characters (e.g., 12-AB123)." |
118 | | - |
119 | | - )] |
120 | | - [TestCase( |
121 | | - "01234 ", |
122 | | - "Invalid professional registration number format. " + |
123 | | - "Valid formats include: 7 digits (e.g., 1234567), 1–2 letters followed by 6 digits (e.g., AB123456), " + |
124 | | - "4–8 digits, an optional 'P' plus 5–6 digits, 'C' or 'P' plus 6 digits, " + |
125 | | - "an optional letter plus 5–6 digits, 'L' plus 4–6 digits, " + |
126 | | - "or 2 digits followed by a hyphen and 4–5 alphanumeric characters (e.g., 12-AB123)." |
127 | | - |
128 | | - )] |
129 | | - [TestCase( |
130 | | - "01234$", |
131 | | - "Invalid professional registration number format. " + |
132 | | - "Valid formats include: 7 digits (e.g., 1234567), 1–2 letters followed by 6 digits (e.g., AB123456), " + |
133 | | - "4–8 digits, an optional 'P' plus 5–6 digits, 'C' or 'P' plus 6 digits, " + |
134 | | - "an optional letter plus 5–6 digits, 'L' plus 4–6 digits, " + |
135 | | - "or 2 digits followed by a hyphen and 4–5 alphanumeric characters (e.g., 12-AB123)." |
136 | | - |
137 | | - )] |
| 108 | + [TestCase(null, ErrorMessagesTestHelper.MissingNumberError)] |
| 109 | + [TestCase("", ErrorMessagesTestHelper.MissingNumberError)] |
| 110 | + [TestCase("1234", ErrorMessagesTestHelper.LengthError)] |
| 111 | + [TestCase("1234", ErrorMessagesTestHelper.LengthError)] |
| 112 | + [TestCase("01234_", ErrorMessagesTestHelper.InvalidFormatError)] |
| 113 | + [TestCase("01234 ", ErrorMessagesTestHelper.InvalidFormatError)] |
| 114 | + [TestCase("01234$", ErrorMessagesTestHelper.InvalidFormatError)] |
138 | 115 | public void ValidateProfessionalRegistrationNumber_sets_error_when_prn_is_invalid( |
139 | 116 | string prn, |
140 | 117 | string expectedError |
|
0 commit comments