コード例 #1
0
        public void GetPratoByIdFail()
        {
            var controller = new PratoController(db);

            var actionResult = controller.GetById(1);
            var result       = actionResult as NotFoundResult;

            Assert.IsNotNull(result);
            Assert.AreEqual(404, result.StatusCode);
        }
コード例 #2
0
        public void GetPratoById()
        {
            var controller = new PratoController(db);
            var pratoTest  = repo.Where(r => r.Nome == "Prato1").FirstOrDefault();

            var actionResult = controller.GetById(pratoTest.Id);
            var result       = actionResult as OkObjectResult;

            Assert.IsNotNull(result);
            Assert.AreEqual(200, result.StatusCode);
        }