public void Deve_RetornarListaVazia()
        {
            Mock <IRepositorioComum <CategoriaEvento> > mockRepo = new Mock <IRepositorioComum <CategoriaEvento> >();

            mockRepo.Setup(x => x.Listar())
            .Returns(new List <CategoriaEvento>());

            _service = new CategoriaService(mockRepo.Object);

            var result = _service.ListarCategorias();

            Assert.True(result != null);
            Assert.True(!result.Any());
        }
        public void Deve_ListarCategoriasExistentes()
        {
            Mock <IRepositorioComum <CategoriaEvento> > mockRepo = new Mock <IRepositorioComum <CategoriaEvento> >();

            mockRepo.Setup(x => x.Listar())
            .Returns(new List <CategoriaEvento>()
            {
                new CategoriaEvento {
                    NomeCategoria = "Nome", IdCategoriaEvento = 1
                }
            });

            _service = new CategoriaService(mockRepo.Object);


            var result = _service.ListarCategorias();

            Assert.True(result.Any());
        }
Ejemplo n.º 3
0
 public ActionResult <List <CategoriaResponseModel> > Get()
 {
     return(_svc.ListarCategorias());
 }