Exemplo n.º 1
0
        public void PegarTodosIngredientes_CompararTotalIngredientes_DeveRetornarVerdadeiro()
        {
            Initialize();

            List <Ingrediente> ValorEsperado = new List <Ingrediente> {
                new Ingrediente {
                    CodigoIngrediente = (int)enumIngredientes.Alface, NomeIngrediente = enumIngredientes.Alface.ToString(), ValorIngrediente = 0.40M
                },
                new Ingrediente {
                    CodigoIngrediente = (int)enumIngredientes.Bacon, NomeIngrediente = enumIngredientes.Bacon.ToString(), ValorIngrediente = 2.00M
                },
                new Ingrediente {
                    CodigoIngrediente = (int)enumIngredientes.HamburguerCarne, NomeIngrediente = enumIngredientes.HamburguerCarne.ToString(), ValorIngrediente = 3.00M
                },
                new Ingrediente {
                    CodigoIngrediente = (int)enumIngredientes.Ovo, NomeIngrediente = enumIngredientes.Ovo.ToString(), ValorIngrediente = 0.80M
                },
                new Ingrediente {
                    CodigoIngrediente = (int)enumIngredientes.Queijo, NomeIngrediente = enumIngredientes.Queijo.ToString(), ValorIngrediente = 1.50M
                }
            };

            List <Ingrediente> resultadoAtual = _ingredienteServico.PegarTodosIngredientes();

            Assert.IsTrue(ValorEsperado.Count == resultadoAtual.Count);
        }
Exemplo n.º 2
0
        public void PromocaoLight_DeveRetornarLancheComDesconto()
        {
            Initialize();

            var todosIngredientesParaPromocaoLight = _ingredienteServico.PegarTodosIngredientes().Where(x => x.NomeIngrediente != "Bacon").ToList();
            var totalLanche            = todosIngredientesParaPromocaoLight.Sum(x => x.ValorIngrediente);
            var totalLancheComDesconto = totalLanche - (totalLanche * 0.10M);
            var atual = _lancheServico.MontarLancheCustomizado(todosIngredientesParaPromocaoLight);

            Assert.AreEqual(atual.DescontoLight, true);
            Assert.AreEqual(atual.Valor, totalLancheComDesconto);
        }
Exemplo n.º 3
0
 public IActionResult RetornaTodosIngredientes()
 {
     try
     {
         var lstIngredientes = _ingrediente.PegarTodosIngredientes();
         return(StatusCode(200, lstIngredientes));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex));
     }
 }