public IActionResult GetById(int id)
        {
            var retorno = _ingredienteBll.Find(id);

            if (retorno == null)
            {
                return(NotFound());
            }

            return(new ObjectResult(retorno));
        }
Beispiel #2
0
        public void TestFind()
        {
            var data = new Ingrediente {
                Id = 1, Descricao = "Teste 1", Valor = 30
            };

            _ingredienteRepositoryMock.Setup(theObject => theObject.Find(1)).Returns(data);
            var ingrediente = _ingredienteBll.Find(1);

            _ingredienteRepositoryMock.Verify(x => x.Find(1), Times.Once());
            Assert.NotNull(ingrediente);
            Assert.Equal(1, ingrediente.Id);
        }