public void ObterPorIdTest() { SuspeitoService service = new SuspeitoService(); Suspeito obtido = service.Find(1); Assert.IsTrue(obtido.Nome == "Esqueleto"); }
protected void CarregarDropDownList() { SuspeitoService suspeitoService = new SuspeitoService(); LocalService localService = new LocalService(); ArmaService armaService = new ArmaService(); ViewBag.Suspeitos = new SelectList(suspeitoService.List(), "Id", "Nome"); ViewBag.Locais = new SelectList(localService.List(), "Id", "Nome"); ViewBag.Armas = new SelectList(armaService.List(), "Id", "Nome"); }
private void CargaDropdowns(int?suspeito = null, int?arma = null, int?local = null) { var suspeitoSvc = new SuspeitoService(); SelectList suspeitos = new SelectList(suspeitoSvc.GetSuspeitos(), "key", "value", suspeito); ViewBag.Suspeitos = suspeitos; var armaSvc = new ArmaService(); SelectList armas = new SelectList(armaSvc.GetArmas(), "key", "value", arma); ViewBag.Armas = armas; var localSvc = new LocalService(); SelectList locais = new SelectList(localSvc.GetLocais(), "key", "value", arma); ViewBag.Locais = locais; }
/// <summary> /// Sorteia um crime /// </summary> /// <returns>Crime</returns> public Crime Sortear() { try{ Crime crime = new Crime(); Random random = new Random(); SuspeitoService suspeitoService = new SuspeitoService(); crime.Suspeito = suspeitoService.Find(random.Next(1, 7)); ArmaService armaService = new ArmaService(); crime.Arma = armaService.Find(random.Next(1, 7)); LocalService localService = new LocalService(); crime.Local = localService.Find(random.Next(1, 11)); return(crime); } catch (Exception) { throw; } }