public decimal ObtieneCostoTransporte(ParametroCalculoMedioTransporteDTO _param) { var costoInicial = ObtieneCalculo(_param.Distancia); var porcentajeExtra = AjusteCosto.ObtieneAjustePorEstacion(_param.FechaCompra); return(Math.Round(_param.Distancia * costoInicial * porcentajeExtra, 2)); }
public decimal ObtieneTiempoTransporte(ParametroCalculoMedioTransporteDTO _param) { decimal PorcentaVariacion = AjusteTiempo.ObtieneAjustePorEstacion(_param.FechaCompra); decimal VelocidadFinal = VelocidadEntrega + (VelocidadEntrega * PorcentaVariacion); decimal TiempoTraslado = Math.Round(_param.Distancia / VelocidadFinal, 2); return(Math.Round(TiempoTraslado, 2)); }
public decimal ObtieneTiempoTransporte(ParametroCalculoMedioTransporteDTO _param) { int EscalasPorKm = Decimal.ToInt32(_param.Distancia / 1000); decimal TiempoAdicional = EscalasPorKm * 6; decimal TiempoTranslado = _param.Distancia / VelocidadEntrega; // horas return(Math.Round(TiempoTranslado + TiempoAdicional, 2)); }
public decimal ObtieneTiempoTransporte(ParametroCalculoMedioTransporteDTO _param) { decimal HorasAdicional = AjusteTiempo.ObtieneAjustePorEstacion(_param.FechaCompra); decimal TiempoTraslado = Math.Round(_param.Distancia / VelocidadEntrega, 2); decimal TiempoExtra = Math.Round((TiempoTraslado / 24) * HorasAdicional, 2); // Dias return(TiempoTraslado + TiempoExtra); }
public decimal ObtieneCostoTransporte(ParametroCalculoMedioTransporteDTO _param) { var costoInicial = ObtieneCalculo(_param.Distancia); int EscalasPorKm = decimal.ToInt32(_param.Distancia / 1000); decimal CargoExtra = 200 * EscalasPorKm; return((_param.Distancia * costoInicial) + CargoExtra); }
public void ObtieneCostoTransporte_22Febrero1200_12200()//Invierno { //Arrange ParametroCalculoMedioTransporteDTO param = new ParametroCalculoMedioTransporteDTO() { FechaCompra = new DateTime(2020, 2, 22), Distancia = 1200 }; List <RangoCosto> lstCostos = new List <RangoCosto>() { new RangoCosto(1m, null, 10m) }; var SUT = new Aereo(lstCostos); //ACT var costo = SUT.ObtieneCostoTransporte(param); //Assert Assert.AreEqual(12200m, costo); }
public void ObtieneCostoTransporte_10Octubre800_8000()//Otoño { //Arrange ParametroCalculoMedioTransporteDTO param = new ParametroCalculoMedioTransporteDTO() { FechaCompra = new DateTime(2020, 10, 10), Distancia = 800 }; List <RangoCosto> lstCostos = new List <RangoCosto>() { new RangoCosto(1m, null, 10m) }; var SUT = new Aereo(lstCostos); //ACT var costo = SUT.ObtieneCostoTransporte(param); //Assert Assert.AreEqual(8000m, costo); }
public void ObtieneTiempoTransporte_22Febrero11592_192() { //Arrange ParametroCalculoMedioTransporteDTO param = new ParametroCalculoMedioTransporteDTO() { FechaCompra = new DateTime(2020, 2, 22), Distancia = 11520 }; List <RangoCosto> lstCostos = new List <RangoCosto>() { new RangoCosto(1m, 50m, 15m), new RangoCosto(51m, 200m, 10m), new RangoCosto(201m, 300, 8m), new RangoCosto(301m, null, 7m) }; var DOCajusteTiempo = new Mock <IAjusteExtra>(); DOCajusteTiempo.Setup(doc => doc.ObtieneAjustePorEstacion(param.FechaCompra)).Returns(8); var SUT = new Terrestre(lstCostos, DOCajusteTiempo.Object); //ACT var costo = SUT.ObtieneTiempoTransporte(param); //Assert Assert.AreEqual(192m, costo); }
public void ObtieneCostoTransporte_10Julio25_375()//Verano { //Arrange ParametroCalculoMedioTransporteDTO param = new ParametroCalculoMedioTransporteDTO() { FechaCompra = new DateTime(2020, 7, 10), Distancia = 25 }; List <RangoCosto> lstCostos = new List <RangoCosto>() { new RangoCosto(1m, 50m, 15m), new RangoCosto(51m, 200m, 10m), new RangoCosto(201m, 300, 8m), new RangoCosto(301m, null, 7m) }; var DOCajusteTiempo = new Mock <IAjusteExtra>(); DOCajusteTiempo.Setup(doc => doc.ObtieneAjustePorEstacion(param.FechaCompra)).Returns(0); var SUT = new Terrestre(lstCostos, DOCajusteTiempo.Object); //ACT var costo = SUT.ObtieneCostoTransporte(param); //Assert Assert.AreEqual(375m, costo); }
public decimal ObtieneCostoTransporte(ParametroCalculoMedioTransporteDTO _param) { decimal costoInicial = ObtieneCalculo(_param.Distancia); return(_param.Distancia * costoInicial); }