public ResultadoOperacion crearProductoIngrediente(string nombre, string codigo, string descripcion, float precioUnitario, string restriccion, string unidadMedida, string ubicacion, int cantidad, string caducidad, string tipoIngrediente) { ResultadoOperacion resultadoOperacion = new ResultadoOperacion(); ProductoIngrediente productoIngrediente = new ProductoIngrediente(); Random random = new Random(); productoIngrediente.Nombre = nombre; productoIngrediente.Código = codigo; productoIngrediente.Descripción = descripcion; productoIngrediente.Restricción = restriccion; productoIngrediente.tipoIngrediente = (TipoIngredienteEnum)Enum.Parse(typeof(TipoIngredienteEnum), tipoIngrediente); Inventario inventario = new Inventario(); // inventario.Caducidad = DateTime.Parse(caducidad); inventario.Caducidad = caducidad; inventario.CantidadIngreso = cantidad; inventario.PrecioCompra = precioUnitario; inventario.Producto = productoIngrediente; inventario.ExistenciaTotal = cantidad; inventario.UnidadDeMedida = unidadMedida; inventario.FechaIngreso = DateTime.Now; ProductoIngredienteDAO productoIngredienteDAO = new ProductoIngredienteDAO(); resultadoOperacion = productoIngredienteDAO.AddProductoIngrediente(productoIngrediente, inventario); return(resultadoOperacion); }
public void AddProductoIngredienteTest() { ProductoIngrediente productoIngrediente = new ProductoIngrediente(); productoIngrediente.Código = "xxx"; productoIngrediente.Descripción = "Papa"; productoIngrediente.Nombre = "Papa"; productoIngrediente.Restricción = "ninguna"; productoIngrediente.tipoIngrediente = TipoIngredienteEnum.Verdura; Inventario inventario = new Inventario(); inventario.Caducidad = DateTime.Now.ToString(); inventario.FechaIngreso = DateTime.Now; inventario.ExistenciaTotal = 1; ProductoIngredienteDAO productoIngredienteDAO = new ProductoIngredienteDAO(); Assert.AreEqual(productoIngredienteDAO.AddProductoIngrediente(productoIngrediente, inventario), ResultadoOperacionEnum.ResultadoOperacion.Exito); }