public void ProbarCostoLuegoDeLaPrimeraPreparacion() { //Primera Fabricacion Fabricacion = new Fabricacion(TerceroEmpleado); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, leche, 15)); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, ArinaPan, 1)); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, azucar, 10)); calderoLeche.AgregarFabricacion(Fabricacion); calderoLeche.AdicionarCantidad(23); leche.SetCantidad(35); azucar.SetCantidad(30); ArinaPan.SetCantidad(0.5); //Segunda Fabricacion Fabricacion = new Fabricacion(TerceroEmpleado); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, leche, 35)); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, ArinaPan, 0.5)); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, azucar, 30)); calderoLeche.AgregarFabricacion(Fabricacion); calderoLeche.AdicionarCantidad(35); //(35.65*23*50 + (35*2000) + (0.5*1000) + (30*1000))/(23*50+35*50) Assert.AreEqual(48.79, calderoLeche.CostoUnitario); Assert.AreEqual((35 + 23) * 50, calderoLeche.Cantidad); }
public void ProbarCreacionDePresentacionSinEnvoltorio() { Fabricacion = new Fabricacion(TerceroEmpleado); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, leche, 15)); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, ArinaPan, 1)); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, azucar, 10)); calderoLeche.AgregarFabricacion(Fabricacion); calderoLeche.AdicionarCantidad(cantidad: 23); ProductoParaVenderDetalle productoParaVenderDetalle = new ProductoParaVenderDetalle(calderoLeche, UnidadesDeLeche); productoParaVenderDetalle.SetCantidadNecesaria(cantidad: 5); UnidadesDeLeche.AgregarDetalle(productoParaVenderDetalle); UnidadesDeLeche. AdicionarCantidad(cantidad: 10); Assert.AreEqual(expected: 178.25, actual: UnidadesDeLeche.CostoUnitario); Assert.AreEqual(expected: 10, actual: UnidadesDeLeche.Cantidad); Console.WriteLine(UnidadesDeLeche.PrecioSugeridoDeVenta); }
public void ProbarCreacionDePresentacionConEnvoltorio() { Fabricacion = new Fabricacion(TerceroEmpleado); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, leche, 15)); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, ArinaPan, 1)); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, azucar, 10)); calderoLeche.AgregarFabricacion(Fabricacion); calderoLeche.AdicionarCantidad(cantidad: 23); ProductoParaVenderDetalle productoParaVenderDetalle = new ProductoParaVenderDetalle(calderoLeche, PresentacionBandejaSelloPlus4Onzas); productoParaVenderDetalle.SetCantidadNecesaria(cantidad: 30); PresentacionBandejaSelloPlus4Onzas.AgregarDetalle(productoParaVenderDetalle); PresentacionBandejaSelloPlus4Onzas. AdicionarCantidad(cantidad: 7); Assert.AreEqual(expected: 1369.5, actual: PresentacionBandejaSelloPlus4Onzas.CostoUnitario); Assert.AreEqual(expected: 4, actual: PresentacionBandejaSelloPlus4Onzas.Cantidad); Console.WriteLine(PresentacionBandejaSelloPlus4Onzas.PrecioSugeridoDeVenta); }
public void ProbarCostoDelaPrimeraFabricacion() { Fabricacion = new Fabricacion(TerceroEmpleado); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, leche, 15)); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, ArinaPan, 1)); Fabricacion.AgregarDetalle(new FabricacionDetalle(Fabricacion, azucar, 10)); calderoLeche.AgregarFabricacion(Fabricacion); calderoLeche.AdicionarCantidad(23); //((15*2000) + (1*1000) + (10*1000))/(0+23*50) Assert.AreEqual(35.65, calderoLeche.CostoUnitario); Console.WriteLine(calderoLeche.PrecioSugeridoDeVenta + " " + calderoLeche.Cantidad); }
private Producto ComprobarExistenciasDeEnMateriasPrimas(FabricacionRequest request, Fabricacion fabricacion, Producto temp) { foreach (FabricacionDetalleRequest detalle in request.Detalles) { Producto productoMateriaPrima = this._unitOfWork.ProductoRepository. FindFirstOrDefault(producto => producto.Nombre == detalle.NombreMateriaPrima); if (productoMateriaPrima == null) { break; } else if (productoMateriaPrima. PuedeDescontarCantidad(detalle.CantidadMateriaPrima).Any()) { temp = productoMateriaPrima; break; } fabricacion. AgregarDetalle(new FabricacionDetalle(fabricacion, productoMateriaPrima, detalle.CantidadMateriaPrima)); } return(temp); }