Skip to content

Commit 6e30f2c

Browse files
committed
ECER-5117: loop replaced with LinQ
1 parent ee2de85 commit 6e30f2c

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/ECER.Engines.Validation/ICRA/IcraEligibilitySubmissionValidationEngine.cs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,10 @@ internal sealed class IcraEligibilitySubmissionValidationEngine : IICRAValidatio
2121
}
2222

2323

24-
// If any InternationalCertification exists, ensure minimally required fields
25-
if (eligibility.InternationalCertifications != null)
24+
if ((eligibility.InternationalCertifications ?? Enumerable.Empty<InternationalCertification>())
25+
.Any(ic => string.IsNullOrWhiteSpace(ic.CertificateTitle)))
2626
{
27-
foreach (var ic in eligibility.InternationalCertifications)
28-
{
29-
if (string.IsNullOrWhiteSpace(ic.CertificateTitle))
30-
{
31-
errors.Add("International certification missing CertificateTitle");
32-
}
33-
}
27+
errors.Add("International certification missing CertificateTitle");
3428
}
3529

3630
if (!eligibility.EmploymentReferences.Any())
@@ -39,15 +33,13 @@ internal sealed class IcraEligibilitySubmissionValidationEngine : IICRAValidatio
3933
}
4034

4135
// If any EmploymentReferences exist, ensure minimally required fields
42-
if (eligibility.EmploymentReferences != null)
36+
if ((eligibility.EmploymentReferences ?? Enumerable.Empty<EmploymentReference>())
37+
.Any(r =>
38+
string.IsNullOrWhiteSpace(r.FirstName) ||
39+
string.IsNullOrWhiteSpace(r.LastName) ||
40+
string.IsNullOrWhiteSpace(r.EmailAddress)))
4341
{
44-
foreach (var r in eligibility.EmploymentReferences)
45-
{
46-
if (string.IsNullOrWhiteSpace(r.FirstName) || string.IsNullOrWhiteSpace(r.LastName) || string.IsNullOrWhiteSpace(r.EmailAddress))
47-
{
48-
errors.Add("Employment reference requires FirstName, LastName, and EmailAddress");
49-
}
50-
}
42+
errors.Add("Employment reference requires FirstName, LastName, and EmailAddress");
5143
}
5244

5345
return new Applications.ValidationResults(errors);

0 commit comments

Comments
 (0)