using System; using Xunit; using Landmark.OLA.Models.Addresses; using Landmark.OLA.Models.Addresses.Enums; using Landmark.OLA.Models.Individuals; using Landmark.OLA.Models.Individuals.Enums; using Landmark.OLA.Models.Loan; using Landmark.OLA.Models.Loan.Enums; using Landmark.OLA.Models.Loan.Validators; using Landmark.OLA.Models.Residences; namespace Landmark.OLA.Tests.Loan.Validators { public class LoanApplicationValidatorSpouseTest { private readonly LoanApplication _LoanApplication = new(DateTime.Parse("2018-02-21T16:52:47.62")) { LoanType = LoanType.CC_CashBack, RequestedAmount = 6000m, PrimaryContactMethod = "1234567890", Purpose = LoanPurpose.Purpose.Other, PrimaryBorrower = new Individual(id: new Guid("8066fa2a-16ba-4148-b28c-2926ba263c5f")) { FirstName = "Jane", MiddleInitial = "A", LastName = "Doe", DOB = new DateTime(2018, 7, 9), Phone = "1235555555", PhoneType = PhoneType.Home, SSN = "000090001", Email = "test@example.com", IsMarried = false, Language = LanguageOption.English, Address = new CurrentResidenceAddress(new Guid("bf7e502a-9830-43c6-b603-1a32294c7e1a")) { Address1 = "123 Main St", City = "New Berlin", State = StateOption.WI, Country = CountryOption.UnitedStates, PostalCode = "53151", MonthsResided = 12, ResidenceType = ResidenceTypeOption.Own, MonthlyPayment = 100, }, MailingAddress = new Address(new Guid("f84db562-36a0-4039-9ce5-346a2ba6899b")) { Address1 = "321 Main St", City = "New Berlin", State = StateOption.WI, Country = CountryOption.UnitedStates, PostalCode = "53151" }, Employers = [ new Employer(employerId: new Guid("eee4efa3-327f-4ce5-9e8b-8c3e7a865fff")) { Name = "College Pro Painters", Title = "tester", WorkPhone = "9992245555", MonthsEmployed = 60, StartDate = new DateTime(2017, 01, 01), CurrentEmployer = true, EmploymentType = EmploymentTypeOption.FullTime, Language = LanguageOption.English, Income = new Income { IncomeTypeCD = IncomeType.Salary, SourceName = "Salary", AmountPerPeriod = 5000.0m, Frequency = Frequency.Annually, IncomeStatus = IncomeStatus.IncomeStatus_Included } } ] }, }; private readonly CoApplicant _CoApplicant = new(new Guid("ba99037f-df92-46d4-a477-ffecea1f4837")) { FirstName = "John", LastName = "Smith", DOB = new DateTime(2018, 7, 25), SSN = "111221111", Phone = "5555550983", PhoneType = PhoneType.Mobile, Email = "john.smith@example.org", IsMarried = true, Language = LanguageOption.English, Address = new CurrentResidenceAddress(new Guid("ae795a5f-1ea3-4186-b4b8-e9f9b81e3059")) { Address1 = "339 1st St", Address2 = "#76", City = "Milwaukee", State = StateOption.WI, Country = CountryOption.UnitedStates, PostalCode = "53202", ResidenceType = ResidenceTypeOption.Rent, MonthsResided = 12, MonthlyPayment = 100, }, PreviousAddresses = [ new ResidenceAddress(new Guid("e7e881f0-d371-4371-8022-cce4f700e6d6")) { Address1 = "339 1st St", Address2 = "#80", City = "Milwaukee", State = StateOption.WI, Country = CountryOption.UnitedStates, PostalCode = "53202", ResidenceType = ResidenceTypeOption.Rent, MonthsResided = 6, }, ], Employers = [ new Employer(employerId: new Guid("e8436884-0e6c-4144-8de5-1f44c7936a23")) { StartDate = new DateTime(2015, 01, 01), Name = "Chocolate Teapot Manfuacturing Inc", EmploymentType = EmploymentTypeOption.PartTime, Title = "Lead Teapot Assembler", WorkPhone = "5556783241", CurrentEmployer = true, Language = LanguageOption.English, Income = new Income { IncomeTypeCD = IncomeType.Salary, SourceName = "Work", Frequency = Frequency.Monthly, IncomeStatus = IncomeStatus.IncomeStatus_Included }, }, new Employer(employerId: new Guid("58d25f44-1260-428d-ac2c-d8804b06ed66")) { StartDate = new DateTime(2015, 01, 01), Name = "Vanilla Teapot Manfuacturing Coop", EmploymentType = EmploymentTypeOption.PartTime, Title = "Junior Teapot Assembler", WorkPhone = "5559572318", CurrentEmployer = true, Language = LanguageOption.English, Income = new Income { IncomeTypeCD = IncomeType.Salary, SourceName = "Work", Frequency = Frequency.Monthly, IncomeStatus = IncomeStatus.IncomeStatus_Included }, }, ], }; [Fact] public void Unmarried() { var validator = new LoanApplicationValidator(); var result = validator.Validate(_LoanApplication); Assert.True(result.IsValid); } [Fact] public void MarriedWithoutSpouseDataInWisconsin() { var validator = new LoanApplicationValidator(); var marriedWithoutSpouse = _LoanApplication; marriedWithoutSpouse.CoApplicant = _CoApplicant; var result = validator.Validate(marriedWithoutSpouse); Assert.False(result.IsValid); } [Fact] public void CoappMarriedToPrimary() { var validator = new LoanApplicationValidator(); var marriedToPrimary = _LoanApplication; marriedToPrimary.CoApplicant = _CoApplicant; marriedToPrimary.CoApplicant.IsMarriedToPrimaryBorrower = true; var result = validator.Validate(marriedToPrimary); Assert.True(result.IsValid); } [Fact] public void CoappHasNonappSpouseInWisconsin() { var validator = new LoanApplicationValidator(); var coappHasNonappSpouse = _LoanApplication; coappHasNonappSpouse.CoApplicant = _CoApplicant; coappHasNonappSpouse.CoApplicant.NonApplicantSpouse = new MailableSpouse { }; var result = validator.Validate(coappHasNonappSpouse); Assert.True(result.IsValid); } [Fact] public void MarriedCoappWithoutSpouseDataInIllinois() { var validator = new LoanApplicationValidator(); var ilCoappMarriedWithoutSpouse = _LoanApplication; ilCoappMarriedWithoutSpouse.CoApplicant = _CoApplicant; ilCoappMarriedWithoutSpouse.CoApplicant.Address.State = StateOption.IL; var result = validator.Validate(ilCoappMarriedWithoutSpouse); Assert.True(result.IsValid); } } }