public void InsertPratoFail() { var prato = new Prato(); var controller = new PratoController(db); var actionResult = controller.InsertPrato(prato); var result = actionResult as BadRequestObjectResult; Assert.IsNotNull(result); Assert.AreEqual(400, result.StatusCode); }
public void InsertPrato() { var restaurantesTest = repoR.Where(r => r.Nome == "Demo1").FirstOrDefault(); var pratoTest = new Prato { RestauranteId = restaurantesTest.Id, Nome = "Prato5", Preco = 50m }; var controller = new PratoController(db); var actionResult = controller.InsertPrato(pratoTest); var result = actionResult as OkObjectResult; Assert.IsNotNull(result); Assert.AreEqual(200, result.StatusCode); }