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.")); }
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")); }
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); }
public CategoriaRepository(GestaoDeProdutoContext _context) { context = _context;// new GestaoDeProdutoContext(); }
public CategoriaRepository() { context = new GestaoDeProdutoContext(); }
public LoginRepository(GestaoDeProdutoContext _context) { context = _context; //new GestaoDeProdutoContext(); }