コード例 #1
0
        public void RegistrarMaterialTest()
        {
            Material_Logica material_Logica = new Material_Logica();
            bool            recibido        = material_Logica.RegistrarMaterial(new Material()
            {
                cantidad = 1,
                costo    = 1,
                tipo     = "tipo"
            }, 1);

            Assert.AreEqual(recibido, true);
        }
コード例 #2
0
        private bool NuevoEgreso()
        {
            Egreso nuevoEgreso = new Egreso()
            {
                concepto = textBox_concepto.Text,
                fecha    = Convert.ToDateTime(textBox_fecha.Text),
                monto    = float.Parse(textBox_monto.Text, NumberFormatInfo.InvariantInfo)
            };
            Egreso_Logica egreso_Logica = new Egreso_Logica();

            if (!egreso_Logica.ComprobarConexion())
            {
                textBlock_mensaje.Text = String.Empty;
                var bold = new Bold(new Run("Se ha perdido conexión con la base de datos")
                {
                    Foreground = Brushes.Red
                });
                textBlock_mensaje.Inlines.Add(bold);
                return(true);
            }
            egreso_Logica.RegistrarEgreso(nuevoEgreso);
            if (textBox_tipo.IsVisible)
            {
                Material nuevoMaterial = new Material()
                {
                    cantidad = int.Parse(textBox_cantidad.Text),
                    costo    = double.Parse(textBox_costo.Text, NumberFormatInfo.InvariantInfo),
                    tipo     = textBox_tipo.Text
                };
                Material_Logica material_Logica = new Material_Logica();
                material_Logica.RegistrarMaterial(
                    nuevoMaterial,
                    egreso_Logica.RecuperarEgreso().Last().Id);
            }
            return(true);
        }