Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #158 from AppliedIS/fix-sendmailtoparent
Browse files Browse the repository at this point in the history
default sendMailToParent
  • Loading branch information
jefferey committed Nov 18, 2016
2 parents b2cb525 + 70a47e4 commit f03706b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
13 changes: 13 additions & 0 deletions DOL.WHD.Section14c.Business/Services/ApplicationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ private void SetDefaults(ApplicationSubmission model)
model.CertificateEffectiveDate = null;
model.CertificateExpirationDate = null;
model.CertificateNumber = null;

// default checkboxes
if (model.Employer != null)
{
if (model.Employer.HasParentOrg.GetValueOrDefault())
{
model.Employer.SendMailToParent = model.Employer.SendMailToParent ?? false;
}
else
{
model.Employer.SendMailToParent = null;
}
}
}

private void CleanupWageTypeInfo(WageTypeInfo wageTypeInfo)
Expand Down
39 changes: 39 additions & 0 deletions DOL.WHD.Section14c.Test/Business/ApplicationServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,5 +224,44 @@ public void ApplicationService_Defaults_AdminFields()
Assert.IsNull(obj.CertificateExpirationDate);
Assert.IsNull(obj.CertificateNumber);
}

[TestMethod]
public void ApplicationService_Defaults_SendMailToParent_Null()
{
// Arrange
var obj = new ApplicationSubmission {Employer = new EmployerInfo {HasParentOrg = true}};

// Act
_applicationService.ProcessModel(obj);

// Assert
Assert.IsFalse(obj.Employer.SendMailToParent.Value);
}

[TestMethod]
public void ApplicationService_Defaults_SendMailToParent_NotNull()
{
// Arrange
var obj = new ApplicationSubmission { Employer = new EmployerInfo { HasParentOrg = true, SendMailToParent = true} };

// Act
_applicationService.ProcessModel(obj);

// Assert
Assert.IsTrue(obj.Employer.SendMailToParent.Value);
}

[TestMethod]
public void ApplicationService_Cleans_SendMailToParent()
{
// Arrange
var obj = new ApplicationSubmission { Employer = new EmployerInfo { SendMailToParent = true } };

// Act
_applicationService.ProcessModel(obj);

// Assert
Assert.IsNull(obj.Employer.SendMailToParent);
}
}
}

0 comments on commit f03706b

Please sign in to comment.