Ejemplo n.º 1
0
        public List <Retorno> InvestigarCrime(List <Teoria> t, Crime c)
        {
            List <Retorno> retornos = new List <Retorno>();

            for (int i = 0; i < t.Count; i++)
            {
                if (t[i].Supeito.Id == c.SupeitoId && t[i].Local.Id == c.LocalId && t[i].Arma.Id == c.ArmaId)
                {
                    retornos.Add(Retorno.Acertou);
                    return(retornos);
                }
                if (t[i].Supeito.Id != c.SupeitoId)
                {
                    retornos.Add(Retorno.ErrouSuspeito);
                }
                if (t[i].Local.Id != c.LocalId)
                {
                    retornos.Add(Retorno.ErrouLocal);
                }
                if (t[i].Arma.Id != c.ArmaId)
                {
                    retornos.Add(Retorno.ErrouArma);
                }
            }
            return(retornos);
        }
Ejemplo n.º 2
0
        public void Deve_investigar_crime_com_uma_Teoria()
        {
            List <Teoria> teorias = new List <Teoria>();
            Suspeito      s1      = new Suspeito();
            Local         l1      = new Local();
            Arma          a1      = new Arma();
            Crime         crime   = new Crime();

            crime.SupeitoId = 1;
            crime.LocalId   = 1;
            crime.ArmaId    = 1;

            s1.Id   = 1;
            s1.Nome = "italo";

            l1.Id   = 2;
            l1.Nome = "Redmond";

            a1.Id   = 3;
            a1.Nome = "Peixeira";

            Teoria t1 = new Teoria(s1, l1, a1);

            teorias.Add(t1);



            var Resultado = crime.InvestigarCrime(teorias, crime);

            Assert.Equal(Retorno.Acertou, Resultado[0]);
        }