public void GetTextToPrintIsNotNull()
 // Test para verificar que get text to print no es nulo.
 {
     //ACT
     recipe.AddStep(step);
     recipe.FinalProduct = FinalProduct;
     //ASSERT
     Assert.IsNotNull(recipe.GetTextToPrint());
 }
Example #2
0
        public void GetProductionCostReturnsRightCalculation() //Prueba que GetProductionCost devuelve el calculo correcto
        {
            double expectedValue = step.GetStepCost() * 2;

            recipe.AddStep(step);
            recipe.AddStep(step);
            recipe.FinalProduct = finalProduct;

            Assert.AreEqual(expectedValue, recipe.GetProductionCost());
        }
        public void AddStepWithExistingNumber()
        {
            var    rec      = new Recipe("Rec");
            string expected = "1. Udrør gær i mælken. \n"
                              + "2. Tilsæt æg. \n";

            rec.AddStep(1, "Tilsæt æg.");
            rec.AddStep(1, "Udrør gær i mælken.");
            string result = rec.PrintSteps();

            Assert.AreEqual(expected, result);
        }
Example #4
0
        // Chequeamos que se imprima correctamente la receta.
        public void GetTextToPrintTest()
        {
            // Arrange
            string HandMade = "Receta de Pizza:\n1 de 'Harina' usando 'horno' durante 1\nCosto de producción: 121";

            // Act
            recetaDePizza.AddStep(batir);
            string MadeByFunction = recetaDePizza.GetTextToPrint();

            // Assert
            Assert.AreEqual(HandMade, MadeByFunction);
        }
Example #5
0
        public void Setup()
        {
            recipe = new Recipe();
            Product product = new Product("Café con leche", 50);

            recipe.FinalProduct = product;
            Step step  = new Step(new Product("Leche", 20), 1, new Equipment("Hervidor", 5), 3);
            Step step2 = new Step(new Product("Café", 25), 2, new Equipment("Cafetera", 5), 3);

            recipe.AddStep(step);
            recipe.AddStep(step2);
        }
        public void RemoveStepMovingOthersInFront()
        {
            var    rec      = new Recipe("Rec");
            string expected = "1. Udrør gær i mælken. \n";

            rec.AddStep(1, "Lun mælken til den er håndvarm.");
            rec.AddStep(2, "Udrør gær i mælken.");

            rec.RemoveStep(1);
            string result = rec.PrintSteps();

            Assert.AreEqual(expected, result);
        }
        public void Setup()
        {
            // Insertá tu código de inicialización aquí
            recipe = new Recipe();
            Product product = new Product("Café con leche", 50);

            recipe.FinalProduct = product;
            Step step  = new Step(new Product("Leche", 20), 1, new Equipment("Cafetera", 5), 3);
            Step step2 = new Step(new Product("Café", 25), 2, new Equipment("Cafetera", 5), 3);

            recipe.AddStep(step);
            recipe.AddStep(step2);
        }
        public void AddStepAdded()
        {
            var    rec      = new Recipe("Rec");
            string expected = "1. Udrør gær i mælken. \n";

            rec.AddStep(1, "Udrør gær i mælken.");
            string result = rec.PrintSteps();

            Assert.AreEqual(expected, result);
        }
        public void EditStepNotSame()
        {
            var    rec         = new Recipe("Rec");
            string notExpected = "1. Udrør gær i mælken. \n";

            rec.AddStep(1, "Udrør gær i mælken.");
            rec.EditStep(1, "Mælken lunes");
            string result = rec.PrintSteps();

            Assert.AreNotEqual(notExpected, result);
        }
        public void EditStepChanges()
        {
            var    rec      = new Recipe("Rec");
            string expected = "1. Mælken lunes og gæren udrøres heri \n";

            rec.AddStep(1, "Udrør gær i mælken.");

            rec.EditStep(1, "Mælken lunes og gæren udrøres heri");
            string result = rec.PrintSteps();

            Assert.AreEqual(expected, result);
        }
Example #11
0
        private void Button_Save_Click(object sender, EventArgs e)
        {
            var recipe = new Recipe();

            recipe.Name        = TextBox_RecipeName.Text;
            recipe.Creator     = TextBox_Creator.Text;
            recipe.Description = TextBox_Description.Text;
            var stepDataSet           = DataGrid_Steps;
            var tagStringWithoutSpace = RemoveWhiteSpace(TextBox_Tags.Text);
            var tags = tagStringWithoutSpace.Split(';');

            foreach (String tag in tags)
            {
                recipe.AddTag(tag);
            }
            foreach (DataGridViewRow row in stepDataSet.Rows)
            {
                if (row.Cells[0].Value != null)
                {
                    String stepDescription  = (String)row.Cells[0].Value;
                    String ingredientString = (String)row.Cells[1].Value;
                    int    timer            = Int32.Parse((String)row.Cells[2].Value);
                    String timeUnit         = row.Cells[3].Value.ToString();

                    Step newStep = new Step();
                    newStep.Description = stepDescription;
                    newStep.SetTimer(timer, GetTimeUnit(timeUnit));
                    if (ingredientString != null)
                    {
                        ProcessIngredient(ref newStep, ingredientString);
                    }
                    recipe.AddStep(newStep);
                }
            }
            recipe.ImagePath = Label_ImagePath.Text;
            var rm = new RecipeManagerAdmin();

            rm.StoreRecipe(recipe);
            MessageBox.Show("Recipe saved!");
        }