first commit
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using CRIF.ACTion.Loan.Assets;
|
||||
using Landmark.OLA.Models.Assets;
|
||||
using Landmark.OLA.Models.Assets.Enums;
|
||||
|
||||
namespace CRIF.ACTion.Tests.Loan
|
||||
{
|
||||
public class LienPositionTest
|
||||
{
|
||||
|
||||
private readonly RealEstateBase _realEstateBase = new()
|
||||
{
|
||||
CurrentlyBeingRemodeledOrImproved = false,
|
||||
CurrentlyListedForSale = true,
|
||||
Use = PropertyUse.SecondHome,
|
||||
LienPosition = new LienPosition
|
||||
{
|
||||
HasFirstMortgage = true,
|
||||
HasSecondMortgage = true,
|
||||
PayoffFirstMortgage = false,
|
||||
PayoffSecondMortgage = false
|
||||
}
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void GetFirstLienPositionTest()
|
||||
{
|
||||
_ = new RealEstateProperty(_realEstateBase);
|
||||
|
||||
using StreamReader file = File.OpenText("Loan" + Path.DirectorySeparatorChar +
|
||||
"json" + Path.DirectorySeparatorChar + "TestLienPositions.json");
|
||||
using JsonTextReader reader = new(file);
|
||||
JObject allData = (JObject)JToken.ReadFrom(reader);
|
||||
JArray firstLien = (JArray)allData["first"];
|
||||
IList<LienPosition> validFirstLienPositions = firstLien.ToObject<IList<LienPosition>>();
|
||||
JArray secondLien = (JArray)allData["second"];
|
||||
IList<LienPosition> validSecondLienPositions = secondLien.ToObject<IList<LienPosition>>();
|
||||
JArray thirdLien = (JArray)allData["third"];
|
||||
IList<LienPosition> validThirdLienPositions = thirdLien.ToObject<IList<LienPosition>>();
|
||||
|
||||
foreach (var position in validFirstLienPositions)
|
||||
{
|
||||
LienPositionType calculatedPosition = RealEstateProperty.GetLienPosition(position);
|
||||
Assert.Equal(LienPositionType.First, calculatedPosition);
|
||||
}
|
||||
foreach (var position in validSecondLienPositions)
|
||||
{
|
||||
LienPositionType calculatedPosition = RealEstateProperty.GetLienPosition(position);
|
||||
Assert.Equal(LienPositionType.Second, calculatedPosition);
|
||||
}
|
||||
foreach (var position in validThirdLienPositions)
|
||||
{
|
||||
LienPositionType calculatedPosition = RealEstateProperty.GetLienPosition(position);
|
||||
Assert.Equal(LienPositionType.Third, calculatedPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user