first commit
This commit is contained in:
+121
@@ -0,0 +1,121 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using Org.XmlUnit.Diff;
|
||||
using Xunit;
|
||||
using CRIF.ACTion.Common.Parsers;
|
||||
using CRIF.ACTion.Loan.Individuals;
|
||||
using Landmark.OLA.Models.Addresses.Enums;
|
||||
using Landmark.OLA.Models.Individuals;
|
||||
using Landmark.OLA.Models.Individuals.Enums;
|
||||
using Landmark.OLA.Models.Residences;
|
||||
|
||||
namespace CRIF.ACTion.Tests.Loan.Individuals
|
||||
{
|
||||
public class AddIndividualResponseParserTest
|
||||
{
|
||||
private readonly IResponseParser<Individual> IndividualParser;
|
||||
private readonly int applicationId = 1100950;
|
||||
|
||||
public AddIndividualResponseParserTest()
|
||||
{
|
||||
IndividualParser = new AddIndividualResponseParser();
|
||||
}
|
||||
|
||||
private readonly Individual individual = new(new Guid("325f9caf-b08a-44dc-af67-bd49db6a822c"))
|
||||
{
|
||||
FirstName = "Jane",
|
||||
MiddleInitial = "A",
|
||||
LastName = "Doe",
|
||||
DOB = new DateTime(2018, 7, 9),
|
||||
Phone = "1235555555",
|
||||
PhoneType = PhoneType.Home,
|
||||
SSN = "000090001",
|
||||
Email = "[email protected]",
|
||||
IsMarried = false,
|
||||
Language = LanguageOption.English,
|
||||
HasOptedOutTCPA = true,
|
||||
Address = new CurrentResidenceAddress(new Guid("325f9caf-b08a-44dc-af67-bd49db6a822c"))
|
||||
{
|
||||
Address1 = "123 Main St",
|
||||
City = "New Berlin",
|
||||
State = StateOption.WI,
|
||||
PostalCode = "53151",
|
||||
Country = CountryOption.UnitedStates,
|
||||
MonthsResided = 12,
|
||||
ResidenceType = ResidenceTypeOption.Own,
|
||||
MonthlyPayment = 100,
|
||||
},
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void ErrorResponseParse()
|
||||
{
|
||||
XmlDocument doc = new();
|
||||
doc.Load("ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AddIndividualError.xml");
|
||||
|
||||
XDocument response;
|
||||
|
||||
using (XmlNodeReader reader = new(doc))
|
||||
{
|
||||
response = XDocument.Load(reader);
|
||||
}
|
||||
|
||||
Exception ex = Assert.Throws<Exception>(() => IndividualParser.Parse(response.Root));
|
||||
|
||||
Assert.Equal("The 'Common:isCollateralGrantorFL' attribute is not declared. on line 1 position 166", ex.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SuccessResponseParse()
|
||||
{
|
||||
XmlDocument doc = new();
|
||||
doc.Load("ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AddIndividualSuccess.xml");
|
||||
|
||||
XDocument response;
|
||||
|
||||
using (XmlNodeReader reader = new(doc))
|
||||
{
|
||||
response = XDocument.Load(reader);
|
||||
}
|
||||
|
||||
var parsedIndividual = IndividualParser.Parse(response.Root);
|
||||
|
||||
Assert.Equal("Jane", parsedIndividual.FirstName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate()
|
||||
{
|
||||
var addIndividual =
|
||||
new AddIndividualRequestBuilder(applicationId.ToString(), individual, TestCommon.GetTestSettings()).Build();
|
||||
|
||||
Assert.Empty(TestCommon.Validate(addIndividual));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CorrectBuild()
|
||||
{
|
||||
var addIndividual =
|
||||
new AddIndividualRequestBuilder(applicationId.ToString(), individual, TestCommon.GetTestSettings()).Build();
|
||||
|
||||
var result = TestCommon.Compare(addIndividual,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AddIndividual-Simple.xml");
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BadNamespace()
|
||||
{
|
||||
var addIndividual =
|
||||
new AddIndividualRequestBuilder(applicationId.ToString(), individual, TestCommon.GetTestSettings()).Build();
|
||||
|
||||
var result = TestCommon.Compare(addIndividual,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AddIndividual-BadNamespace.xml");
|
||||
|
||||
Assert.NotEmpty(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using CRIF.ACTion.Common;
|
||||
using CRIF.ACTion.Loan.Individuals;
|
||||
using Landmark.OLA.Models.Addresses.Enums;
|
||||
using Landmark.OLA.Models.Residences;
|
||||
|
||||
namespace CRIF.ACTion.Tests.Loan.Individuals
|
||||
{
|
||||
public class AddressesSectionTest
|
||||
{
|
||||
public ResidenceAddress ValidAddress = new(new Guid("a333a064-be7b-4d20-841f-9c3c306866b3"))
|
||||
{
|
||||
Address1 = "123 Main St",
|
||||
City = "New Berlin",
|
||||
State = StateOption.WI,
|
||||
Country = CountryOption.UnitedStates,
|
||||
PostalCode = "53151",
|
||||
MonthsResided = 12,
|
||||
ResidenceType = ResidenceTypeOption.Own,
|
||||
};
|
||||
|
||||
|
||||
[Fact]
|
||||
public void AddAddress()
|
||||
{
|
||||
var section = new AddressesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
section.AddAddress(ValidAddress, ContactMechanisms.CrifContactMechanism.CurrentAddress);
|
||||
|
||||
var addressElement = section.Build();
|
||||
|
||||
var result = TestCommon.Compare(addressElement,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AddressesSection"
|
||||
+ System.IO.Path.DirectorySeparatorChar + "AddAddress.xml");
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
+215
@@ -0,0 +1,215 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
using CRIF.ACTion.Loan.Individuals;
|
||||
using Landmark.OLA.Models.Addresses.Enums;
|
||||
using Landmark.OLA.Models.Individuals;
|
||||
using Landmark.OLA.Models.Individuals.Enums;
|
||||
using Landmark.OLA.Models.Residences;
|
||||
|
||||
namespace CRIF.ACTion.Tests.Loan.Individuals
|
||||
{
|
||||
public class AppPartiesSectionTest
|
||||
{
|
||||
private static Guid TestGuid => new("a333a064-be7b-4d20-841f-9c3c306866b3");
|
||||
|
||||
private readonly Individual Individual = new(new Guid("3580f8c9-db39-42f9-a9f3-133fe4a3b002"))
|
||||
{
|
||||
FirstName = "Jane",
|
||||
MiddleInitial = "A",
|
||||
LastName = "Doe",
|
||||
DOB = new DateTime(2018, 7, 9),
|
||||
Phone = "1235555555",
|
||||
PhoneType = PhoneType.Home,
|
||||
SSN = "000090001",
|
||||
Email = "[email protected]",
|
||||
IsMarried = false,
|
||||
Address = new CurrentResidenceAddress
|
||||
{
|
||||
Address1 = "123 Main St",
|
||||
City = "New Berlin",
|
||||
State = StateOption.WI,
|
||||
PostalCode = "53151",
|
||||
MonthsResided = 12,
|
||||
ResidenceType = ResidenceTypeOption.Own,
|
||||
MonthlyPayment = 100,
|
||||
},
|
||||
OtherIncomes =
|
||||
[
|
||||
new Income
|
||||
{
|
||||
IncomeTypeCD = IncomeType.Alimony,
|
||||
SourceName = "Child Support",
|
||||
AmountPerPeriod = 500.0m,
|
||||
Frequency = Frequency.Annually,
|
||||
IncomeStatus = IncomeStatus.IncomeStatus_Included
|
||||
}
|
||||
],
|
||||
Employers =
|
||||
[
|
||||
new Employer
|
||||
{
|
||||
Name = "College Pro Painters",
|
||||
Title = "tester",
|
||||
WorkPhone = "9992245555",
|
||||
MonthsEmployed = 60,
|
||||
CurrentEmployer = true,
|
||||
EmploymentType = EmploymentTypeOption.FullTime,
|
||||
Income = new Income
|
||||
{
|
||||
IncomeTypeCD = IncomeType.Salary,
|
||||
SourceName = "Salary",
|
||||
AmountPerPeriod = 5000.0m,
|
||||
Frequency = Frequency.Annually,
|
||||
IncomeStatus = IncomeStatus.IncomeStatus_Included
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
private readonly IIndividualHistory HistoryIndividual = new HistoryIndividual(new Guid("3580f8c9-db39-42f9-a9f3-133fe4a3b002"))
|
||||
{
|
||||
FirstName = "Jane",
|
||||
MiddleInitial = "A",
|
||||
LastName = "Doe",
|
||||
DOB = new DateTime(2018, 7, 9),
|
||||
Phone = "1235555555",
|
||||
PhoneType = PhoneType.Home,
|
||||
SSN = "000090001",
|
||||
Email = "[email protected]",
|
||||
Address = new CurrentResidenceAddress
|
||||
{
|
||||
Address1 = "123 Main St",
|
||||
City = "New Berlin",
|
||||
State = StateOption.WI,
|
||||
PostalCode = "53151",
|
||||
MonthsResided = 12,
|
||||
ResidenceType = ResidenceTypeOption.Own,
|
||||
MonthlyPayment = 100,
|
||||
},
|
||||
OtherIncomes =
|
||||
[
|
||||
new Income
|
||||
{
|
||||
IncomeTypeCD = IncomeType.Alimony,
|
||||
SourceName = "Child Support",
|
||||
AmountPerPeriod = 500.0m,
|
||||
Frequency = Frequency.Annually,
|
||||
IncomeStatus = IncomeStatus.IncomeStatus_Included
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void AddIndividualBorrowerParty()
|
||||
{
|
||||
var section = new AppPartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
section.AddIndividualParty(Individual, AppPartiesSection.PartyType.borrower, false);
|
||||
|
||||
var partyElement = section.Build();
|
||||
|
||||
var result = TestCommon.Compare(partyElement,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AppPartiesSection"
|
||||
+ System.IO.Path.DirectorySeparatorChar + "AddIndividualBorrowerParty.xml");
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddIndividualNonSigningPrimarySpouseParty()
|
||||
{
|
||||
var section = new AppPartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
section.AddIndividualParty(HistoryIndividual, AppPartiesSection.PartyType.NonSigningSpouseMarriedToPrimary);
|
||||
|
||||
var partyElement = section.Build();
|
||||
|
||||
var result = TestCommon.Compare(partyElement,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AppPartiesSection"
|
||||
+ System.IO.Path.DirectorySeparatorChar + "AddIndividualNonSigningPrimarySpouseParty.xml");
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddIndividualNonSigningCoApplicantSpouseParty()
|
||||
{
|
||||
var section = new AppPartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
section.AddIndividualParty(HistoryIndividual, AppPartiesSection.PartyType.NonSigningSpouseMarriedToCoBorrower);
|
||||
|
||||
var partyElement = section.Build();
|
||||
|
||||
var result = TestCommon.Compare(partyElement,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AppPartiesSection"
|
||||
+ System.IO.Path.DirectorySeparatorChar + "AddIndividualNonSigningCoApplicantSpouseParty.xml");
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddRentAndAlimony()
|
||||
{
|
||||
var section = new AppPartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
section.AddIndividualParty(Individual, AppPartiesSection.PartyType.borrower);
|
||||
|
||||
var partyElement = section.Build();
|
||||
|
||||
var result = TestCommon.Compare(partyElement,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AppPartiesSection"
|
||||
+ System.IO.Path.DirectorySeparatorChar + "AddIndividualBorrowerParty.xml");
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddIndividualPrimaryBorrowerParty()
|
||||
{
|
||||
var section = new AppPartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
section.AddIndividualParty(Individual, AppPartiesSection.PartyType.primaryBorrower);
|
||||
|
||||
var partyElement = section.Build();
|
||||
|
||||
var result = TestCommon.Compare(partyElement,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AppPartiesSection"
|
||||
+ System.IO.Path.DirectorySeparatorChar + "AddIndividualPrimaryBorrowerParty.xml");
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetSourceChannel()
|
||||
{
|
||||
var section = new AppPartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
section.SetSourceChannel(TestGuid);
|
||||
|
||||
var partyElement = section.Build();
|
||||
|
||||
var result = TestCommon.Compare(partyElement,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AppPartiesSection"
|
||||
+ System.IO.Path.DirectorySeparatorChar + "SetSourceChannel.xml");
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetServicingChannel()
|
||||
{
|
||||
var section = new AppPartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
section.SetServicingChannel(TestGuid);
|
||||
|
||||
var partyElement = section.Build();
|
||||
|
||||
var result = TestCommon.Compare(partyElement,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "AppPartiesSection"
|
||||
+ System.IO.Path.DirectorySeparatorChar + "SetServicingChannel.xml");
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
+50
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Xml.Linq;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using CRIF.ACTion.Loan.Individuals;
|
||||
using Landmark.OLA.Models.Individuals;
|
||||
using Landmark.OLA.Models.Individuals.Enums;
|
||||
|
||||
namespace CRIF.ACTion.Tests.Loan.Individuals
|
||||
{
|
||||
public class IncomeSectionBuilderTest : BuilderTestBase
|
||||
{
|
||||
private readonly ITestOutputHelper output;
|
||||
|
||||
public IncomeSectionBuilderTest(ITestOutputHelper output)
|
||||
{
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Build_Income_Fail()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => new IncomeSectionBuilder(new Income()).Build());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildIncomeSuccess()
|
||||
{
|
||||
var income = new Income()
|
||||
{
|
||||
AmountPerPeriod = 100,
|
||||
Frequency = Frequency.Annually,
|
||||
HoursPerWeek = 10,
|
||||
IncomeStatus = IncomeStatus.IncomeStatus_Excluded,
|
||||
IncomeTypeCD = IncomeType.Commissions,
|
||||
SourceName = "Job"
|
||||
};
|
||||
|
||||
var incomeElement = new IncomeSectionBuilder(income).Build();
|
||||
|
||||
output.WriteLine(Serialize(incomeElement));
|
||||
|
||||
string comparePath = @"Loan\Individuals\ExampleXML\BuildIncomeSuccess.xml";
|
||||
|
||||
var results = TestCommon.Compare(incomeElement, comparePath);
|
||||
|
||||
Assert.Empty(results);
|
||||
}
|
||||
}
|
||||
}
|
||||
+451
@@ -0,0 +1,451 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Xunit;
|
||||
using CRIF.ACTion.Common;
|
||||
using CRIF.ACTion.Loan.Individuals;
|
||||
using Landmark.OLA.Models;
|
||||
using Landmark.OLA.Models.Addresses;
|
||||
using Landmark.OLA.Models.Addresses.Enums;
|
||||
using Landmark.OLA.Models.HomeMortgageDisclosureAct;
|
||||
using Landmark.OLA.Models.Individuals;
|
||||
using Landmark.OLA.Models.Individuals.Enums;
|
||||
using Landmark.OLA.Models.Loan.Enums;
|
||||
using Landmark.OLA.Models.Residences;
|
||||
|
||||
namespace CRIF.ACTion.Tests.Loan.Individuals
|
||||
{
|
||||
public class PartiesSectionTest
|
||||
{
|
||||
private static Guid TestGuid => new("e4a1a31a-3985-4f76-955c-9227c9c94ba8");
|
||||
|
||||
private static readonly IApplicant TestIndividual = new Individual(new Guid("67755afb-b125-4a48-959e-7cedead90f8f"))
|
||||
{
|
||||
FirstName = "Jane",
|
||||
MiddleInitial = "A",
|
||||
LastName = "Doe",
|
||||
Suffix = Suffix.III,
|
||||
DOB = new DateTime(2018, 7, 9),
|
||||
Phone = "1235555555",
|
||||
PhoneType = PhoneType.Home,
|
||||
SSN = "000090001",
|
||||
Email = "[email protected]",
|
||||
IsMarried = false,
|
||||
Language = LanguageOption.English,
|
||||
Address = new CurrentResidenceAddress(new Guid("b09444c1-c12f-4c3e-b787-04c44b6be0c4"))
|
||||
{
|
||||
Address1 = "123 Main St",
|
||||
City = "New Berlin",
|
||||
State = StateOption.WI,
|
||||
Country = CountryOption.UnitedStates,
|
||||
PostalCode = "53151",
|
||||
MonthsResided = 12,
|
||||
ResidenceType = ResidenceTypeOption.Own,
|
||||
MonthlyPayment = 100,
|
||||
},
|
||||
OtherIncomes =
|
||||
[
|
||||
new Income
|
||||
{
|
||||
IncomeTypeCD = IncomeType.SocialSecurity,
|
||||
Frequency = Frequency.Monthly,
|
||||
SourceName = "Freeform Text",
|
||||
AmountPerPeriod = 123.45m,
|
||||
IncomeStatus = IncomeStatus.IncomeStatus_Included,
|
||||
},
|
||||
new Income
|
||||
{
|
||||
IncomeTypeCD = IncomeType.Alimony,
|
||||
Frequency = Frequency.Annually,
|
||||
SourceName = "Child Support",
|
||||
AmountPerPeriod = 600,
|
||||
IncomeStatus = IncomeStatus.IncomeStatus_Included,
|
||||
}
|
||||
],
|
||||
Employers =
|
||||
[
|
||||
new Employer(employerId: new Guid("2fd067f2-bd3d-4053-990e-f4282180db63"))
|
||||
{
|
||||
Name = "College Pro Painters",
|
||||
Title = "tester",
|
||||
WorkPhone = "9992245555",
|
||||
StartDate = new DateTime(2017, 01, 01),
|
||||
MonthsEmployed = 60,
|
||||
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
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
public static IEnumerable<Object[]> GetSuffixElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
var suffixElements = PartiesSection.GetSuffixElement(TestIndividual);
|
||||
|
||||
yield return new Object[] {
|
||||
suffixElements,
|
||||
"GetSuffixElement.xml"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetTradesElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
var mockPropertyLot = new PropertyLot
|
||||
{
|
||||
RentalAmt = 150
|
||||
};
|
||||
var tradesElement = PartiesSection.GetTradesElement(TestIndividual, mockPropertyLot);
|
||||
|
||||
yield return new Object[] {
|
||||
tradesElement,
|
||||
"GetTradesElement.xml"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> AddChannelParty()
|
||||
{
|
||||
var section = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
section.AddSourceChannelParty(TestGuid, LoanType.EQ_HELOC_Flex);
|
||||
|
||||
yield return new Object[] {
|
||||
section.Build(),
|
||||
"AddChannelParty.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> AddEmployer()
|
||||
{
|
||||
var section = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
section.AddEmployer(TestIndividual.Employers.First());
|
||||
|
||||
yield return new Object[] {
|
||||
section.Build(),
|
||||
"AddEmployer.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetContactMechanismElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
var contactElement = PartiesSection.GetContactMechanismElement(TestIndividual.Phone, ContactMechanisms.CrifContactMechanism.HomePhone);
|
||||
|
||||
yield return new Object[] {
|
||||
contactElement,
|
||||
"GetContactMechanismElement.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetContactMechanismsSectionElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
var element = PartiesSection.GetContactMechanismsSectionElement(TestIndividual);
|
||||
|
||||
yield return new Object[] {
|
||||
element,
|
||||
"GetContactMechanismsSectionElement.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetEmployerContactMechanismsSectionElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
var element = PartiesSection.GetEmployerContactMechanismsSectionElement(TestIndividual.Employers.First());
|
||||
|
||||
yield return new Object[] {
|
||||
element,
|
||||
"GetEmployerContactMechanismsSectionElement.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetIncomesSectionElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
var element = PartiesSection.GetIncomesSectionElement(TestIndividual);
|
||||
|
||||
yield return new Object[] {
|
||||
element,
|
||||
"GetIncomesSectionElement.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetMaritalStatusElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
var isMarried = PartiesSection.GetMaritalStatusElement(true);
|
||||
|
||||
yield return new Object[] {
|
||||
isMarried,
|
||||
"GetMaritalStatusElement-True.xml"
|
||||
};
|
||||
|
||||
var isNotMarried = PartiesSection.GetMaritalStatusElement(false);
|
||||
|
||||
yield return new Object[] {
|
||||
isNotMarried,
|
||||
"GetMaritalStatusElement-False.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetPartyRelationshipsSectionElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
var element = PartiesSection.GetApplicantPartyRelationshipsSectionElement(TestIndividual);
|
||||
|
||||
yield return new Object[] {
|
||||
element,
|
||||
"GetPartyRelationshipsSectionElement.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> AddIndividual()
|
||||
{
|
||||
var section = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
section.AddApplicant(TestIndividual);
|
||||
|
||||
yield return new Object[] {
|
||||
section.Build(),
|
||||
"AddIndividual.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> AddOrganizationParty()
|
||||
{
|
||||
var section = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
section.AddOrganizationParty(TestGuid);
|
||||
|
||||
yield return new Object[] {
|
||||
section.Build(),
|
||||
"AddOrganizationParty.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetAddressContactMechanismElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
var currentAddress = PartiesSection.GetAddressContactMechanismElement(TestGuid, ContactMechanisms.CrifContactMechanism.CurrentAddress);
|
||||
|
||||
yield return new Object[] {
|
||||
currentAddress,
|
||||
"GetAddressContactMechanismElement-Current.xml"
|
||||
};
|
||||
|
||||
var previousAddress = PartiesSection.GetAddressContactMechanismElement(TestGuid, ContactMechanisms.CrifContactMechanism.PreviousAddress);
|
||||
|
||||
yield return new Object[] {
|
||||
previousAddress,
|
||||
"GetAddressContactMechanismElement.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetEthnicitiesElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
var individualEthnicityAndDidNotFurnish = new Individual
|
||||
{
|
||||
HmdaValues = new Hmda
|
||||
{
|
||||
Ethnicities = [Ethnicity.Cuban],
|
||||
}
|
||||
};
|
||||
|
||||
yield return new Object[] {
|
||||
PartiesSection.GetEthnicitiesElement(individualEthnicityAndDidNotFurnish),
|
||||
"GetEthnicitiesElement.xml"
|
||||
};
|
||||
|
||||
var individual = new Individual
|
||||
{
|
||||
HmdaValues = new Hmda
|
||||
{
|
||||
Ethnicities =
|
||||
[
|
||||
Ethnicity.Cuban,
|
||||
Ethnicity.NotProvided,
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
yield return new Object[] {
|
||||
PartiesSection.GetEthnicitiesElement(individual),
|
||||
"GetEthnicitiesElement.xml"
|
||||
};
|
||||
|
||||
var individualDidNotFurnish = new Individual
|
||||
{
|
||||
HmdaValues = new Hmda
|
||||
{
|
||||
Ethnicities =
|
||||
[
|
||||
Ethnicity.NotProvided,
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
yield return new Object[] {
|
||||
PartiesSection.GetEthnicitiesElement(individualDidNotFurnish),
|
||||
"GetEthnicitiesElement-DidNotProvide.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetRacesElement()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
var individual = new Individual
|
||||
{
|
||||
HmdaValues = new Hmda
|
||||
{
|
||||
Races =
|
||||
[
|
||||
Race.AmericanIndianAlaskaNative,
|
||||
Race.OtherPacificIslander,
|
||||
],
|
||||
AmericanIndianAlaskaNativeTribe = "Forest County Potawatomi",
|
||||
OtherAsianRace = "Hmong",
|
||||
}
|
||||
};
|
||||
|
||||
yield return new Object[] {
|
||||
PartiesSection.GetRacesElement(individual),
|
||||
"GetRacesElement.xml"
|
||||
};
|
||||
|
||||
var individualWithNotProvided = new Individual
|
||||
{
|
||||
HmdaValues = new Hmda
|
||||
{
|
||||
Races =
|
||||
[
|
||||
Race.AmericanIndianAlaskaNative,
|
||||
Race.OtherPacificIslander,
|
||||
Race.NotProvided
|
||||
],
|
||||
AmericanIndianAlaskaNativeTribe = "Forest County Potawatomi",
|
||||
OtherAsianRace = "Hmong",
|
||||
}
|
||||
};
|
||||
|
||||
yield return new Object[] {
|
||||
PartiesSection.GetRacesElement(individualWithNotProvided),
|
||||
"GetRacesElement.xml"
|
||||
};
|
||||
|
||||
var individualOnlyNotProvided = new Individual
|
||||
{
|
||||
HmdaValues = new Hmda
|
||||
{
|
||||
Races =
|
||||
[
|
||||
Race.NotProvided
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
yield return new Object[] {
|
||||
PartiesSection.GetRacesElement(individualOnlyNotProvided),
|
||||
"GetRacesElement-NotProvided.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetSexAttributes()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
|
||||
var individual = new Individual
|
||||
{
|
||||
HmdaValues = new Hmda
|
||||
{
|
||||
Sexes =
|
||||
[
|
||||
Sex.Female,
|
||||
Sex.NotProvided,
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
var individualElement = new XElement(CrifNamespaces.Common + "individual", PartiesSection.GetSexAttributes(individual));
|
||||
|
||||
yield return new Object[] {
|
||||
individualElement,
|
||||
"GetSexAttributes.xml"
|
||||
};
|
||||
|
||||
var individualNotProvided = new Individual
|
||||
{
|
||||
HmdaValues = new Hmda
|
||||
{
|
||||
Sexes =
|
||||
[
|
||||
Sex.NotProvided,
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
individualElement = new XElement(CrifNamespaces.Common + "individual", PartiesSection.GetSexAttributes(individualNotProvided));
|
||||
|
||||
yield return new Object[] {
|
||||
individualElement,
|
||||
"GetSexAttributes-NotProvided.xml"
|
||||
};
|
||||
}
|
||||
|
||||
public static IEnumerable<Object[]> GetNoCoApplicantDetermination()
|
||||
{
|
||||
_ = new PartiesSection("", TestCommon.GetTestSettings());
|
||||
var individualElement = new XElement(CrifNamespaces.Common + "determinations");
|
||||
PartiesSection.AddNonApplicantHmdaDetermination(individualElement);
|
||||
|
||||
yield return new object[]
|
||||
{
|
||||
individualElement,
|
||||
"GetNoCoApplicantDetermination.xml"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(AddChannelParty))]
|
||||
[MemberData(nameof(AddEmployer))]
|
||||
[MemberData(nameof(AddIndividual))]
|
||||
[MemberData(nameof(AddOrganizationParty))]
|
||||
[MemberData(nameof(GetContactMechanismElement))]
|
||||
[MemberData(nameof(GetContactMechanismsSectionElement))]
|
||||
[MemberData(nameof(GetEmployerContactMechanismsSectionElement))]
|
||||
[MemberData(nameof(GetIncomesSectionElement))]
|
||||
[MemberData(nameof(GetMaritalStatusElement))]
|
||||
[MemberData(nameof(GetAddressContactMechanismElement))]
|
||||
[MemberData(nameof(GetPartyRelationshipsSectionElement))]
|
||||
[MemberData(nameof(GetEthnicitiesElement))]
|
||||
[MemberData(nameof(GetRacesElement))]
|
||||
[MemberData(nameof(GetSexAttributes))]
|
||||
[MemberData(nameof(GetTradesElement))]
|
||||
[MemberData(nameof(GetSuffixElement))]
|
||||
[MemberData(nameof(GetNoCoApplicantDetermination))]
|
||||
public void CheckXmlCreation(XElement xElement, string fileName)
|
||||
{
|
||||
Assert.True(ModelValidator.TryValidate(xElement));
|
||||
|
||||
var result = TestCommon.Compare(xElement,
|
||||
"ExampleXML" + System.IO.Path.DirectorySeparatorChar + "PartiesSection"
|
||||
+ System.IO.Path.DirectorySeparatorChar + fileName);
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user