public void Servico_Deletar_Success() { //-- Arrange repoServico.Save(new ServicoModel(_empresa, "Serviço 6", 50, false)); string nomeServico = "Serviço 6"; ServicoModel s = sv.Find(_empresa.Id, nomeServico); //-- Act sv.Delete(s.Id); s = sv.Find(s.Id); //-- Asserts Assert.IsTrue(s.Deletado); }
public void CleanUp() { ListaNomesToDelete.Add("Leo 5"); ListaNomesToDelete.Add("Leo 4"); ListaNomesToDelete.Add("Leo 3"); ListaNomesToDelete.Add("Leo 2"); ListaNomesToDelete.Add("Leo 1"); ListaNomesToDelete.Add("Leonardo"); ListaNomesToDelete.Add("Leo Renomeado"); ListaNomesToDelete.Add("DeletarFuncionario"); ListaNomesToDelete.Add("RecoverFuncionario"); if (ListaNomesToDelete.IsNotNull() || ListaNomesToDelete.Count > 0) { ListaNomesToDelete.ForEach(nome => { FuncionarioModel o = sv.Find(_empresa.Id, nome); if (o.IsNotNull()) { repoFuncionario.Delete(o.Id); } }); } ServicoModel s = svServico.Find(_empresa.Id, "Corte Teste"); if (s.IsNotNull()) { svServico.Delete(s.Id); } s = svServico.Find(_empresa.Id, "Luzes Teste"); if (s.IsNotNull()) { svServico.Delete(s.Id); } DeleteEmpresa(); }
public ActionResult Delete(long id, ServicoViewModel objeto) { try { sv.Delete(id); ServicoModel s = sv.Find(id); TempData["Nome"] = s.Nome; TempData["Acao"] = "criado"; return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); return(View()); } }