Exemple #1
0
        public void TesteCategoriaTituloEspaco()
        {
            Categoria novaCategoria = new Categoria();

            novaCategoria.titulo = "    ";
            GestaoDeProdutoContext gestaoDeProduto     = new GestaoDeProdutoContext();
            CategoriaRepository    categoriaRepository = new CategoriaRepository(gestaoDeProduto);
            CategoriaService       _service            = new CategoriaService(categoriaRepository);
            var ex = Assert.Throws <Exception>(() => _service.insere(novaCategoria));

            Assert.That(ex.Message, Is.EqualTo("Nome obrigatório."));
        }
Exemple #2
0
        public void TesteCategoriaNomeComNumero()
        {
            Categoria novaCategoria = new Categoria();

            novaCategoria.titulo = "teste1";
            GestaoDeProdutoContext gestaoDeProduto     = new GestaoDeProdutoContext();
            CategoriaRepository    categoriaRepository = new CategoriaRepository(gestaoDeProduto);
            CategoriaService       _service            = new CategoriaService(categoriaRepository);
            var ex = Assert.Throws <Exception>(() => _service.insere(novaCategoria));

            Assert.That(ex.Message, Is.EqualTo("Nome contem números , só é permitido letras"));
        }
Exemple #3
0
        public void InsereNovaCategoria()
        {
            Categoria novaCategoria = new Categoria();

            novaCategoria.titulo = "Teste";
            GestaoDeProdutoContext gestaoDeProduto     = new GestaoDeProdutoContext();
            CategoriaRepository    categoriaRepository = new CategoriaRepository(gestaoDeProduto);
            CategoriaService       _service            = new CategoriaService(categoriaRepository);
            int retorno = _service.insere(novaCategoria);

            Assert.Greater(retorno, 0);
        }
Exemple #4
0
 public CategoriaRepository(GestaoDeProdutoContext _context)
 {
     context = _context;// new GestaoDeProdutoContext();
 }
Exemple #5
0
 public CategoriaRepository()
 {
     context = new GestaoDeProdutoContext();
 }
Exemple #6
0
 public LoginRepository(GestaoDeProdutoContext _context)
 {
     context = _context; //new GestaoDeProdutoContext();
 }