Skip to content

Commit

Permalink
Fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hortha committed Oct 3, 2023
1 parent 4d67558 commit 88827c5
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected async Task ValidRequestForTeacher_ReturnsExpectedContent(
bool expectEysCertificateUrl)
{
// Arrange
var contact = CreateContact(trn);
var contact = await CreateContact(trn);

dfeta_qtsregistration[]? qtsRegistrations = null;
if (qualifiedInWales)
Expand Down Expand Up @@ -94,7 +94,7 @@ protected async Task ValidRequestForTeacherWithMultiWordFirstName_ReturnsExpecte
bool expectCertificateUrls)
{
// Arrange
var contact = CreateContact(trn, hasMultiWordFirstName: true);
var contact = await CreateContact(trn, hasMultiWordFirstName: true);

await ConfigureMocks(trn, contact);

Expand Down Expand Up @@ -144,7 +144,7 @@ protected async Task ValidRequestWithInduction_ReturnsExpectedInductionContent(
bool expectCertificateUrls)
{
// Arrange
var contact = CreateContact(trn);
var contact = await CreateContact(trn);
var induction = CreateInduction();
var inductionPeriods = CreateInductionPeriods();

Expand Down Expand Up @@ -194,7 +194,7 @@ protected async Task ValidRequestWithInitialTeacherTraining_ReturnsExpectedIniti
string trn)
{
// Arrange
var contact = CreateContact(trn);
var contact = await CreateContact(trn);
var itt = CreateItt(contact);

await ConfigureMocks(trn, contact, itt);
Expand Down Expand Up @@ -261,7 +261,7 @@ protected async Task ValidRequestWithNpqQualifications_ReturnsExpectedNpqQualifi
bool expectCertificateUrls)
{
// Arrange
var contact = CreateContact(trn);
var contact = await CreateContact(trn);

var npqQualificationNoAwardDate = CreateQualification(dfeta_qualification_dfeta_Type.NPQLL, null, dfeta_qualificationState.Active, null);
var npqQualificationInactive = CreateQualification(dfeta_qualification_dfeta_Type.NPQSL, new DateTime(2022, 5, 6), dfeta_qualificationState.Inactive, null);
Expand Down Expand Up @@ -313,7 +313,7 @@ protected async Task ValidRequestWithMandatoryQualifications_ReturnsExpectedMand
string trn)
{
// Arrange
var contact = CreateContact(trn);
var contact = await CreateContact(trn);

var mandatoryQualificationNoAwardDate = CreateQualification(dfeta_qualification_dfeta_Type.MandatoryQualification, null, dfeta_qualificationState.Active, "Visual Impairment");
var mandatoryQualificationNoSpecialism = CreateQualification(dfeta_qualification_dfeta_Type.MandatoryQualification, new DateTime(2022, 2, 3), dfeta_qualificationState.Active, null);
Expand Down Expand Up @@ -357,7 +357,7 @@ protected async Task ValidRequestWithHigherEducationQualifications_ReturnsExpect
string trn)
{
// Arrange
var contact = CreateContact(trn);
var contact = await CreateContact(trn);
var qualification1AwardDate = new DateTime(2022, 4, 6);
var qualification1Name = "My HE Qual 1";
var qualification1Subject1 = (Code: "Qualification1Subject1", Name: "Qualification 1 Subject 1");
Expand Down Expand Up @@ -471,7 +471,7 @@ protected async Task ValidRequestForContactWithPendingNameChange_ReturnsPendingN
string trn)
{
// Arrange
var contact = CreateContact(trn);
var contact = await CreateContact(trn);

var incidents = new[]
{
Expand Down Expand Up @@ -501,7 +501,7 @@ protected async Task ValidRequestForContactWithPendingDateOfBirthChange_ReturnsP
string trn)
{
// Arrange
var contact = CreateContact(trn);
var contact = await CreateContact(trn);

var incidents = new[]
{
Expand Down Expand Up @@ -531,7 +531,7 @@ protected async Task ValidRequestWithSanctions_ReturnsExpectedSanctionsContent(
string trn)
{
// Arrange
var contact = CreateContact(trn);
var contact = await CreateContact(trn);

var sanctions = new (string SanctionCode, DateOnly? StartDate)[]
{
Expand Down Expand Up @@ -661,6 +661,7 @@ private async Task ConfigureMocks(

await TestData.OrganizationService.CreateAsync(new dfeta_sanction()
{
Id = Guid.NewGuid(),
dfeta_PersonId = contact.Id.ToEntityReference(Contact.EntityLogicalName),
dfeta_SanctionCodeId = sanctionCode.Id.ToEntityReference(dfeta_sanctioncode.EntityLogicalName),
dfeta_Spent = false,
Expand All @@ -669,7 +670,7 @@ await TestData.OrganizationService.CreateAsync(new dfeta_sanction()
}
}

private static Contact CreateContact(string trn, bool hasMultiWordFirstName = false)
private async Task<Contact> CreateContact(string trn, bool hasMultiWordFirstName = false)
{
var contactId = Guid.NewGuid();
var firstName1 = Faker.Name.First();
Expand Down Expand Up @@ -700,6 +701,8 @@ private static Contact CreateContact(string trn, bool hasMultiWordFirstName = fa
EMailAddress1 = email
};

await TestData.OrganizationService.CreateAsync(teacher);

return teacher;
}

Expand Down

0 comments on commit 88827c5

Please sign in to comment.