public ActionResult Investigar(int response)
        {
            Detective detective = new Detective("Lin Ust Orvalds");

            Witness witness = new Witness(this.dataContext.Responses.ToList()[response]);

            Case caseInvestigation = this.GetCase();

            Response resposeOfCase = detective.SolveCase(caseInvestigation, witness);

            return View("_RespotaInvestigacao", resposeOfCase);
        }
        private bool WhoGun(ResponseType response, ResponseType responseRigth, TheoryService theoryService, Witness witness, Theory theory)
        {
            if (response == responseRigth)
            {
                Theory newTheory = theoryService.NextTheory(true, true, false);

                ResponseType newResponse = witness.Reply(newTheory);

                if (WhoGun(newResponse, response, theoryService, witness, theory))
                    theory.Gun = newTheory.Gun;

                return false;
            }

            return true;
        }
        public bool WhoSuspect(ResponseType response, ResponseType responseRigth, TheoryService theoryService, Witness witness, Theory theory)
        {
            if (response == responseRigth)
            {
                Theory newTheory = theoryService.NextTheory(false, true, true);

                ResponseType newResponse = witness.Reply(newTheory);

                if (WhoSuspect(newResponse, response, theoryService, witness, theory))
                    theory.Suspect = newTheory.Suspect;

                return false;
            }

            return true;
        }
        public void Obter_Resposta_Arma_4_Local_6_Suspeito_6()
        {
            // Arrange
            Response respostaEsperada = new Response()
            {
                Gun = "Arma 4",
                Local = "Local 6",
                Suspect = "Suspeito 6"
            };

            Witness testemunha = new Witness(respostaEsperada);

            // Act
            InterrogationService servicoDeInterrogacao = new InterrogationService(testemunha, this.caso);
            Response respostaRetornada = servicoDeInterrogacao.Start();

            // Assert
            Assert.AreEqual<string>(respostaEsperada.Suspect, respostaRetornada.Suspect);
            Assert.AreEqual<string>(respostaEsperada.Local, respostaRetornada.Local);
            Assert.AreEqual<string>(respostaEsperada.Gun, respostaRetornada.Gun);
        }
        public Response SolveCase(Case caseToResulve, Witness witness)
        {
            this.interrogationService = new InterrogationService(witness, caseToResulve);

            return this.interrogationService.Start();
        }
 public InterrogationService(Witness witness, Case caseForInterrogation)
 {
     this.witness = witness;
     this.theoryService = new TheoryService(caseForInterrogation);
 }