public string CrearMensajeDePedido(Pedido _entPedido, DateTime _dtFechaHoy, string _cFormatoMesaje, List <Paqueteria> _lstPaqueteria, ref bool _lEntregado) { string cMensaje = string.Empty, cRangoTiempo = string.Empty, cMensajeOpcionEconomica = string.Empty;; DateTime dtFechaEntrega = new DateTime(); double dTiempoTraslado = 0; decimal dCostoEnvio = 0.0M; IObtenerMensaje IObtenerMensaje = null; TimeSpan tiempo = new TimeSpan(); dTiempoTraslado = ObtenerTiempoTraslado(_entPedido.iDistancia, _entPedido.entTransporte.iVelodicad); dtFechaEntrega = ObtenerFechaEntrega(_entPedido.dtPedido, dTiempoTraslado); dCostoEnvio = ObtenerCostoEnvio(_entPedido); if (dtFechaEntrega < _dtFechaHoy) { tiempo = _dtFechaHoy.Subtract(dtFechaEntrega); IObtenerMensaje = new ObtenerMensajeEnvioEntregado(); _lEntregado = true; } else { tiempo = dtFechaEntrega.Subtract(_dtFechaHoy); IObtenerMensaje = new ObtenerMensajeEnvioPendiente(); _lEntregado = false; } cRangoTiempo = this.ManejadorRangoTiempo.ObtenerTextoRangoTiempo(tiempo); cMensaje = IObtenerMensaje.ObtenerMensaje(_cFormatoMesaje, _entPedido, cRangoTiempo, dCostoEnvio); cMensajeOpcionEconomica = IVerificarOpcionEconomica.ObtenerOpcioneEconomica(_entPedido, _lstPaqueteria, dCostoEnvio); if (!string.IsNullOrWhiteSpace(cMensajeOpcionEconomica)) { cMensaje += "\n" + cMensajeOpcionEconomica; } return(cMensaje); }
public void ObtenerMensaje_EnviarPedidoVacioRangoTiempoVacioCostoCero_ObtieneMensaje() { string cMensaje = string.Empty; string cFormatoMesaje = "Tu paquete {0} de {1} y {2} a {3} {4} {5} y {6} un costo de {7} (Cualquier reclamación con {8})."; Pedido entPedido = new Pedido(); string cRangoTiempo = string.Empty; decimal dCosto = 0.0m; ObtenerMensajeEnvioPendiente ObtenerMensajeEnvioPendiente = new ObtenerMensajeEnvioPendiente(); cMensaje = ObtenerMensajeEnvioPendiente.ObtenerMensaje(cFormatoMesaje, entPedido, cRangoTiempo, dCosto); Assert.IsTrue(!string.IsNullOrWhiteSpace(cMensaje)); }
public void ObtenerMensaje_EnviarPedidoRangoTiempoCosto_ObtieneMensaje() { string cMensaje = string.Empty; string cFormatoMesaje = "Tu paquete {0} de {1} y {2} a {3} {4} {5} y {6} un costo de {7} (Cualquier reclamación con {8})."; Pedido entPedido = new Pedido() { cOrigen = "Origen", cDestino = "Destino", cPaqueteria = "PAqueteria" }; string cRangoTiempo = "Rango"; decimal dCosto = 100.0m; ObtenerMensajeEnvioPendiente ObtenerMensajeEnvioPendiente = new ObtenerMensajeEnvioPendiente(); cMensaje = ObtenerMensajeEnvioPendiente.ObtenerMensaje(cFormatoMesaje, entPedido, cRangoTiempo, dCosto); Assert.IsTrue(!string.IsNullOrWhiteSpace(cMensaje)); }