Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 0da3775

Browse files
committed
Refactoring
1 parent a5f0c20 commit 0da3775

File tree

1 file changed

+7
-20
lines changed
  • src/ServiceLayer.Mesh/FileTypes/NbssAppointmentEvents/Validation

1 file changed

+7
-20
lines changed

src/ServiceLayer.Mesh/FileTypes/NbssAppointmentEvents/Validation/FileValidator.cs

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,10 @@ public partial class FileValidator : IFileValidator
1515

1616
public IEnumerable<ValidationError> Validate(ParsedFile file)
1717
{
18-
foreach (var error in ValidateHeaderPresence(file))
19-
{
20-
yield return error;
21-
}
22-
23-
foreach (var error in ValidateTrailerPresence(file))
24-
{
25-
yield return error;
26-
}
27-
28-
foreach (var error in ValidateExtractId(file))
29-
{
30-
yield return error;
31-
}
32-
33-
foreach (var error in ValidateRecordCount(file))
34-
{
35-
yield return error;
36-
}
18+
return ValidateHeaderPresence(file)
19+
.Concat(ValidateTrailerPresence(file))
20+
.Concat(ValidateExtractId(file))
21+
.Concat(ValidateRecordCount(file));
3722
}
3823

3924
private static IEnumerable<ValidationError> ValidateHeaderPresence(ParsedFile file)
@@ -103,7 +88,9 @@ private IEnumerable<ValidationError> ValidateRecordCount(ParsedFile file)
10388
Error = "Record count does not match value in header",
10489
Scope = ValidationErrorScope.Trailer
10590
};
106-
} else if (headerRecordCountErrors.Count == 0 && file.DataRecords.Count != int.Parse(file.FileHeader.RecordCount!))
91+
}
92+
else if (headerRecordCountErrors.Count == 0 &&
93+
file.DataRecords.Count != int.Parse(file.FileHeader.RecordCount!))
10794
{
10895
yield return new ValidationError
10996
{

0 commit comments

Comments
 (0)