Elig 3501 test suite for internal wf checks - #533
Conversation
LiliNedeleva
commented
Aug 28, 2026
- Create new test factories for generating standard and working family test cases
- Move and tidy up old code to factories and make the accessible through the gateway
- Centralise all test configurations in one place. Ensure dictionaries are safely populated.
- Create new test scenarios for internal checks
…in internal workflows
… validity start date assignment for old hashed checks
|
Could we add unit tests around |
…ndling in internal workflows
YiannosGeorgantas
left a comment
There was a problem hiding this comment.
Thanks, Lili. The latest changes address the other points I raised. I’m leaving this as request changes for now because the unit tests for the new scenario factory are still outstanding, along with the open clarification about the configured suffixes versus the hard-coded values. I’ll re-review once those are updated.
…gibility check mappings + missing enginegateway tests
Add unit tests for WorkingFamiliesTestScenarioFactory and enhance eligibility check mappings + missing enginegateway tests More integration testing will follow from the consumer side. No more tests will be added to this PR at this stage |
| // Fallback: generate before the due-now window | ||
| wfEvent.ValidityEndDate = | ||
| RandomDateGenerator(wfEvent.ValidityStartDate, dueWindowStart.AddDays(-1)); | ||
| RandomDateGenerator(checkDate.AddDays(1), dueWindowStart.AddDays(-1)); |
There was a problem hiding this comment.
Could you check this fallback range please? dueWindowStart is assigned from checkDate, so this passes checkDate.AddDays(1) as the start and checkDate.AddDays(-1) as the end. When this fallback is reached near the end of a term, RandomDateGenerator will therefore receive a start date after its end date and throw. What date range should represent the intended “not due now” fallback here?
There was a problem hiding this comment.
Reviewed and amended.
| { | ||
| Assert.That( | ||
| () => _sut.GenerateTestScenarioInternalSide(CreateCheckData("99900000000")), | ||
| Throws.TypeOf<NullReferenceException>()); |
There was a problem hiding this comment.
Should an unmatched scenario return null rather than make a NullReferenceException part of the expected behaviour? The factory method has a nullable return type, and CheckingEngineGateway explicitly handles a null result by returning notFound. The exception currently occurs because null is passed into PopulateCommonFields, which looks accidental rather than an intentional contract. Could the factory guard against that and this test assert a null result instead?
There was a problem hiding this comment.
Absolutely, this should be fixed now
| [TestCase("70200000000", "AB123456A")] | ||
| [TestCase("70300000000", "AB123456A")] | ||
| [TestCase("70400000000", "AB123456A")] | ||
| public void GenerateTestScenarioInternalSide_GeneratesConfiguredScenario(string eligibilityCode, string nino) |
There was a problem hiding this comment.
Could these cases assert the defining outcome of each scenario rather than only that an event and its common fields are returned? The current assertions would still pass if 701, 702, 703 and 704 all invoked the same scenario builder. I think we need assertions confirming that 701 is valid for the current term only, 702 for the current and next terms, 703 has VED passed but GPED still active, and 704 has GPED passed.
There was a problem hiding this comment.
Alright, I have now enhanced the eligibility scenario unit tests.
YiannosGeorgantas
left a comment
There was a problem hiding this comment.
Thanks for adding the new test coverage, Lili. I’ve identified three points that I think need addressing before approval: the invalid fallback date range, the unmatched-scenario test expecting a NullReferenceException despite the caller supporting a null result, and the need for the scenario tests to verify the distinct outcomes of 701–704. The earlier configuration-suffix conversation also remains open. I’ll re-review once these are updated.
Thanks, I’ve reviewed the linked commit and can see the additional factory and gateway coverage. I’ve raised the specific remaining points separately in my latest review, so I’ll continue the re-review through those inline conversations. |
…ks and new test cases