Files
monorepo/LCU.API.Internal.OnlineLoanApp/CRIF.ACTion.Tests/Loan/VehicleEtcTest.cs
T
2026-03-11 11:18:25 -05:00

321 lines
12 KiB
C#

using System;
using System.Xml.Linq;
using Xunit;
using CRIF.ACTion.Loan;
using Landmark.OLA.Models;
using Landmark.OLA.Models.Addresses.Enums;
using Landmark.OLA.Models.Assets;
using Landmark.OLA.Models.Assets.Enums;
using Landmark.OLA.Models.HomeMortgageDisclosureAct;
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.Residences;
using Landmark.OLA.Models.Addresses;
namespace CRIF.ACTion.Tests.Loan
{
public class VehicleEtcTest
{
private readonly LoanApplication _loanApplication =
new(loanDate: DateTime.Parse("2018-01-01T06:00:00.0000000Z", null, System.Globalization.DateTimeStyles.AssumeLocal), loanId: "7c0d9659-4d37-4ae7-93ce-e6c72ad6a0b5")
{
LoanType = LoanType.V_Vehicle,
Purpose = LoanPurpose.Purpose.Purchase,
RequestedAmount = 7500,
PrimaryContactMethod = "1234567890",
TermLengthInMonths = 48,
DisclosureDate = DateTime.Parse("2019-03-08T19:50:26.429Z"),
IPAddress = "111.11.1111",
Vehicle = new Vehicle(valuationId: new Guid("254d06dd-9da2-4013-8021-c9aaf591807f"),
vehicleId: new Guid("7c0d9659-4d37-4ae7-93ce-e6c72ad6a0b5"))
{
ValuationType = VehicleValuationType.Invoice,
Year = 2019,
InitialEstimatedValue = 10000,
Make = "Datsun",
Model = "Go-Cross",
Mileage = 38,
Condition = NewUsed.New,
Type = VehicleType.Automobile
},
PrimaryBorrower = new Individual(new Guid("b0fb7c37-a203-4c06-89cb-e4e9f3ca20d4"))
{
Language = LanguageOption.English,
FirstName = "Jane",
MiddleInitial = "J",
LastName = "Doe",
DOB = new DateTime(2018, 01, 01),
SSN = "666666666",
Phone = "5555550100",
PhoneType = PhoneType.Home,
Email = "[email protected]",
IsMarried = false,
Address = new CurrentResidenceAddress(new Guid("66eecd56-4877-47d9-b2b1-45d11a087322"))
{
Address1 = "123 Main St",
City = "New Berlin",
State = StateOption.WI,
Country = CountryOption.UnitedStates,
PostalCode = "53151",
MonthlyPayment = 1000m,
MonthsResided = 120,
ResidenceType = ResidenceTypeOption.Own,
},
HmdaValues = new Hmda
{
HmdaNoticeDisclosed = true,
Races =
[
Race.NotProvided,
],
Ethnicities =
[
Ethnicity.OtherHispanicLatino,
],
OtherHispanicLatinoEthnicity = "Argentinean",
Sexes =
[
Sex.Female,
Sex.Male,
],
},
Employers =
[
new Employer(employerId: new Guid("57df49cc-ff09-4660-aa47-54fdb5e08017"))
{
Language = LanguageOption.English,
Name = "Purple Widgets Inc",
CurrentEmployer = true,
EmploymentType = EmploymentTypeOption.FullTime,
MonthsEmployed = 120,
StartDate = new DateTime(2008, 01, 01),
EndDate = new DateTime(2018,01,01),
Title = "Lead Widget Painter",
Income = new Income
{
IncomeTypeCD = IncomeType.Salary,
SourceName = "Job",
AmountPerPeriod = 100m,
Frequency = Frequency.Hourly,
HoursPerWeek = 40,
IncomeStatus = IncomeStatus.IncomeStatus_Included,
},
},
],
}
};
private static XElement BuildApplication(LoanApplication loanApplication)
{
var createAppElement = new LoanApplicationRequestBuilder(loanApplication, TestCommon.GetTestSettings(),
new Guid("741be6b4-9f42-4efd-871f-f5d99c0ef122"), new Guid("e814d860-14fe-4bef-be9b-21be3dce1edf"),
new Guid("3090a5a1-d493-4865-ba44-8fd390dfec44"), new TestDistributionChannelLookupService()).Build();
return createAppElement;
}
[Fact]
public void Validate()
{
ModelValidator.Validate(_loanApplication.Vehicle);
var createAppElement =
new LoanApplicationRequestBuilder(_loanApplication, TestCommon.GetTestSettings()).Build();
Assert.Empty(TestCommon.Validate(createAppElement));
}
[Fact]
public void CreateApplication()
{
var createAppElement = BuildApplication(_loanApplication);
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "Vehicle" + System.IO.Path.DirectorySeparatorChar + "CreateApp.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
[Fact]
public void CreateMotorcyleApplication()
{
var motorcycleApplication = _loanApplication;
motorcycleApplication.Vehicle.Type = VehicleType.Motorcycle;
motorcycleApplication.Vehicle.Make = "Honda";
motorcycleApplication.Vehicle.Model = "Gold Wing";
var createAppElement = BuildApplication(_loanApplication);
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "Vehicle" + System.IO.Path.DirectorySeparatorChar + "CreateMotorcycleApp.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
[Fact]
public void CreatePreApprovalApplication()
{
var preApprovalApplication = _loanApplication;
preApprovalApplication.LoanType = LoanType.V_VehiclePreapproval;
preApprovalApplication.Vehicle = null;
var createAppElement = BuildApplication(_loanApplication);
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "Vehicle" + System.IO.Path.DirectorySeparatorChar + "CreatePreApprovalApp.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
[Fact]
public void CreateBoatApplication()
{
var boatApplication = _loanApplication;
boatApplication.LoanType = LoanType.M_Boat;
boatApplication.Vehicle.Type = VehicleType.Boat;
boatApplication.Vehicle.BoatAddress = new Address(new Guid("60899299-c5b3-4683-bd3b-02a8ab1af35e"))
{
Address1 = "123 Boat Location Ave",
PostalCode = "12345",
City = "Schenectady",
State = StateOption.NY,
Country = CountryOption.UnitedStates
};
boatApplication.Vehicle.BoatLength = 16;
boatApplication.Vehicle.TrailerMake = "Trailer Make";
boatApplication.Vehicle.TrailerType = "TriAxle";
boatApplication.Vehicle.TrailerYear = 2010;
boatApplication.Vehicle.MotorMake = "Motor Make";
boatApplication.Vehicle.MotorModel = "Motor Model";
boatApplication.Vehicle.MotorType = 2;
boatApplication.Vehicle.MotorYear = 2005;
var createAppElement = BuildApplication(_loanApplication);
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "Vehicle" + System.IO.Path.DirectorySeparatorChar + "CreateBoatApp.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
[Fact]
public void CreateAtvApplication()
{
var boatApplication = _loanApplication;
boatApplication.LoanType = LoanType.P_Powersport;
boatApplication.Vehicle.Type = VehicleType.ATV;
var createAppElement = BuildApplication(_loanApplication);
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "Vehicle" + System.IO.Path.DirectorySeparatorChar + "CreateAtvApp.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
[Fact]
public void CreatePwcApplication()
{
var boatApplication = _loanApplication;
boatApplication.LoanType = LoanType.P_Powersport;
boatApplication.Vehicle.Type = VehicleType.PWC;
var createAppElement = BuildApplication(_loanApplication);
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "Vehicle" + System.IO.Path.DirectorySeparatorChar + "CreatePwcApp.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
[Fact]
public void CreateRvPowersportApplication()
{
var boatApplication = _loanApplication;
boatApplication.LoanType = LoanType.P_Powersport;
boatApplication.Vehicle.Type = VehicleType.RecreationalVehicle;
var createAppElement = BuildApplication(_loanApplication);
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "Vehicle" + System.IO.Path.DirectorySeparatorChar + "CreateRvPowersportApp.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
[Fact]
public void CreateSnowmobileApplication()
{
var boatApplication = _loanApplication;
boatApplication.LoanType = LoanType.P_Powersport;
boatApplication.Vehicle.Type = VehicleType.Snowmobile;
var createAppElement = BuildApplication(_loanApplication);
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "Vehicle" + System.IO.Path.DirectorySeparatorChar + "CreateSnowmobileApp.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
[Fact]
public void CreateMotorhomeApplication()
{
var motorhomeApplication = _loanApplication;
motorhomeApplication.LoanType = LoanType.T_TrailerMotorhome;
motorhomeApplication.Vehicle.Type = VehicleType.TrailerMotorHome;
var createAppElement = BuildApplication(_loanApplication);
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "Vehicle" + System.IO.Path.DirectorySeparatorChar + "CreateTrailerMotorhomeApp.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
[Fact]
public void CreateApplicationWithNoteAndVehicleSeller()
{
_loanApplication.Note = "Example application note.";
_loanApplication.Vehicle.Seller = VehicleSeller.Private_Party;
var createAppElement = BuildApplication(_loanApplication);
string comparePath = @"ExampleXML/Vehicle/CreateApplicationWithNoteAndVehicleSeller.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
[Fact]
public void CreateApplicationWithVehicleSeller()
{
_loanApplication.Vehicle.Seller = VehicleSeller.Dealer;
var createAppElement = BuildApplication(_loanApplication);
string comparePath = @"ExampleXML/Vehicle/CreateApplicationWithVehicleSeller.xml";
var results = TestCommon.Compare(createAppElement, comparePath);
Assert.Empty(results);
}
}
}