Adding
This commit is contained in:
+172
@@ -0,0 +1,172 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LCU.API.Collections.RepoApi.Domain.FloorPricing;
|
||||
using LCU.API.Collections.RepoApi.Domain.FloorPricing.Strategies;
|
||||
using LCU.API.Collections.RepoApi.Services;
|
||||
using LCU.Shared.Collections.RepoApiLib.Models;
|
||||
using LCU.Shared.Collections.RepoApiLib.WebServices.NADA;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace LCU.API.Collections.RepoApiTests
|
||||
{
|
||||
public class NadaMmrConditionValueTest
|
||||
{
|
||||
private IEnumerable<VehicleFloorPricingParameters> GetFloorPricingParams()
|
||||
{
|
||||
return new List<VehicleFloorPricingParameters>()
|
||||
{
|
||||
new VehicleFloorPricingParameters()
|
||||
{
|
||||
LowCondition = 0,
|
||||
HighCondition = 1.5m,
|
||||
PercentageOf = 95,
|
||||
MMRAdjustedValue = "Regional Value",
|
||||
NADAFirstValue = "Low Value",
|
||||
NADASecondValue = "Low Value"
|
||||
},
|
||||
new VehicleFloorPricingParameters()
|
||||
{
|
||||
LowCondition = 1.6m,
|
||||
HighCondition = 2.5m,
|
||||
PercentageOf = 95,
|
||||
MMRAdjustedValue = "National Value",
|
||||
NADAFirstValue = "Low Value",
|
||||
NADASecondValue = "Avg Value"
|
||||
},
|
||||
new VehicleFloorPricingParameters()
|
||||
{
|
||||
LowCondition = 2.6m,
|
||||
HighCondition = 3.5m,
|
||||
PercentageOf = 95,
|
||||
MMRAdjustedValue = "Regional Value",
|
||||
NADAFirstValue = "Avg Value",
|
||||
NADASecondValue = "Avg Value"
|
||||
},
|
||||
new VehicleFloorPricingParameters()
|
||||
{
|
||||
LowCondition = 3.6m,
|
||||
HighCondition = 4.5m,
|
||||
PercentageOf = 95,
|
||||
MMRAdjustedValue = "Regional Value",
|
||||
NADAFirstValue = "Avg Value",
|
||||
NADASecondValue = "High Value"
|
||||
},
|
||||
new VehicleFloorPricingParameters()
|
||||
{
|
||||
LowCondition = 4.6m,
|
||||
HighCondition = 5.0m,
|
||||
PercentageOf = 95,
|
||||
MMRAdjustedValue = "National Value",
|
||||
NADAFirstValue = "High Value",
|
||||
NADASecondValue = "High Value"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Full_Calculate_Floor_Price_OK()
|
||||
{
|
||||
NadaMmrConditionValue calculator = new NadaMmrConditionValue();
|
||||
FloorPriceCalculationParams fpcParams = new FloorPriceCalculationParams()
|
||||
{
|
||||
ImsAutoFileData = new ImsAutoFileData()
|
||||
{
|
||||
VehicleGrade = 3.0m,
|
||||
ApprovedVehicleGrade = 3.0m,
|
||||
AuctionGuideBookPrice = 5004.0m
|
||||
},
|
||||
CollateralValuation = new CollateralValuation()
|
||||
{
|
||||
LowAdjustedAuctionValue = 2000,
|
||||
HighAdjustedAuctionValue = 3000,
|
||||
AverageAdjustedAuctionValue = 2500
|
||||
},
|
||||
VehicleFloorPricingParameters = GetFloorPricingParams()
|
||||
};
|
||||
var result = calculator.CalculateFloorPrice(fpcParams);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(3565, result.FloorPrice);
|
||||
Assert.True(result.Success);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Full_Calculate_Floor_Price_NoNada()
|
||||
{
|
||||
NadaMmrConditionValue calculator = new NadaMmrConditionValue();
|
||||
FloorPriceCalculationParams fpcParams = new FloorPriceCalculationParams()
|
||||
{
|
||||
ImsAutoFileData = new ImsAutoFileData()
|
||||
{
|
||||
VehicleGrade = 3.0m,
|
||||
ApprovedVehicleGrade = 3.0m,
|
||||
AuctionGuideBookPrice = 5004.0m
|
||||
},
|
||||
CollateralValuation = null,
|
||||
VehicleFloorPricingParameters = GetFloorPricingParams()
|
||||
};
|
||||
var result = calculator.CalculateFloorPrice(fpcParams);
|
||||
Assert.NotNull(result);
|
||||
|
||||
Assert.False(result.Success);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Full_Calculate_Floor_Price_NoAutoIms()
|
||||
{
|
||||
NadaMmrConditionValue calculator = new NadaMmrConditionValue();
|
||||
FloorPriceCalculationParams fpcParams = new FloorPriceCalculationParams()
|
||||
{
|
||||
ImsAutoFileData = null,
|
||||
CollateralValuation = new CollateralValuation()
|
||||
{
|
||||
LowAdjustedAuctionValue = 2000,
|
||||
HighAdjustedAuctionValue = 3000,
|
||||
AverageAdjustedAuctionValue = 2500
|
||||
},
|
||||
VehicleFloorPricingParameters = GetFloorPricingParams()
|
||||
};
|
||||
var result = calculator.CalculateFloorPrice(fpcParams);
|
||||
Assert.NotNull(result);
|
||||
Assert.False(result.Success);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Full_Calculate_Floor_Price_No_Prices()
|
||||
{
|
||||
NadaMmrConditionValue calculator = new NadaMmrConditionValue();
|
||||
FloorPriceCalculationParams fpcParams = new FloorPriceCalculationParams()
|
||||
{
|
||||
ImsAutoFileData = new ImsAutoFileData()
|
||||
{
|
||||
VehicleGrade = 3.0m,
|
||||
ApprovedVehicleGrade = 3.0m,
|
||||
AuctionGuideBookPrice = 5004.0m,
|
||||
MMRNationalAdjustedPrice = 0m,
|
||||
MMRRegionalAdjustedPrice = 0m
|
||||
},
|
||||
CollateralValuation = new CollateralValuation()
|
||||
{
|
||||
LowAdjustedAuctionValue = 0,
|
||||
HighAdjustedAuctionValue = 0,
|
||||
AverageAdjustedAuctionValue = 0
|
||||
},
|
||||
VehicleFloorPricingParameters = GetFloorPricingParams()
|
||||
};
|
||||
var result = calculator.CalculateFloorPrice(fpcParams);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(-1, result.ResultWeight);
|
||||
Assert.False(result.Success);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Empty_Nada_Price_List_Wont_Throw()
|
||||
{
|
||||
NadaMmrConditionValue calculator = new NadaMmrConditionValue();
|
||||
List<Decimal> nadaValues = new List<decimal>();
|
||||
var result = calculator.GetNadaAvgValue(nadaValues);
|
||||
Assert.Equal(0, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user