using System; using System.Xml.Linq; using Xunit; using CRIF.ACTion.Common; using CRIF.ACTion.Loan; 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.Residences; namespace CRIF.ACTion.Tests.Loan { public class SignatureLoanTest { 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.S_Signature, Purpose = LoanPurpose.Purpose.Other, PurposeOfLoanSignature = "Test Purpose", RequestedAmount = 13000, PrimaryContactMethod = "1234567890", DisclosureDate = DateTime.Parse("2019-03-08T19:50:26.429Z"), IPAddress = "111.11.1111", TermLengthInMonths = 36, 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 = "janej@example.net", 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, } } }; 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() { 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 + "Signature" + System.IO.Path.DirectorySeparatorChar + "CreateApp.xml"; var results = TestCommon.Compare(createAppElement, comparePath); Assert.Empty(results); } [Fact] public void AddPurposeOfLoanSignature() { var appDetailElement = new XElement(CrifNamespaces.App + "Test", new XAttribute(CrifNamespaces.App + "financedAmt", _loanApplication.RequestedAmount) ); if (_loanApplication.LoanType == LoanType.S_Signature) { appDetailElement.Add(new XAttribute("purposeOfLoanSignature", "Testing Purpose of Loan Signature")); } Assert.True(appDetailElement.Attribute("purposeOfLoanSignature").Value == "Testing Purpose of Loan Signature"); } } }