Exemple #1
0
        public void RetornaGanhadoresQuina()
        {
            ApostaNeg.NumerosSorteados = new List <int>();
            ApostaNeg.NumerosSorteados.Add(1);
            ApostaNeg.NumerosSorteados.Add(2);
            ApostaNeg.NumerosSorteados.Add(3);
            ApostaNeg.NumerosSorteados.Add(4);
            ApostaNeg.NumerosSorteados.Add(5);
            ApostaNeg.NumerosSorteados.Add(6);

            RegistrarApostaClass apost = new RegistrarApostaClass()
            {
                CodigoTipoAposta = (char)ETipoAposta.MegaSena,
                Numeros          = new int[] { 1, 2, 3, 4, 5, 60 }
            };

            ApostaNeg.RegistrarNovaAposta(apost);

            IList <RegistrarApostaClass> resultado = ApostaNeg.RetornaGanhadoresQuina((char)ETipoAposta.MegaSena);

            if (resultado != null && resultado.Count > 0)
            {
                Assert.Pass();
            }
            Assert.Fail();
        }
 public IEnumerable <RegistrarApostaClass> RetornaApostas([FromBody] RegistrarApostaClass aposta)
 {
     try
     {
         return(ApostaNeg.RetornaApostas(aposta.CodigoTipoAposta));
     }
     catch
     {
         return(new List <RegistrarApostaClass>());
     }
 }
 public IEnumerable <RegistrarApostaClass> CarregarGanhadoresQuadra([FromBody] RegistrarApostaClass aposta)
 {
     try
     {
         return(ApostaNeg.RetornaGanhadoresQuadra(aposta.CodigoTipoAposta));
     }
     catch
     {
         return(new List <RegistrarApostaClass>());
     }
 }
Exemple #4
0
        public static RegistrarApostaClass Surpresinha(char codigoTipoAposta)
        {
            BaseTipoApostaNeg    tipoApostaNeg = BaseTipoApostaNeg.Instanciar(codigoTipoAposta);
            RegistrarApostaClass aposta        = new RegistrarApostaClass()
            {
                CodigoTipoAposta = codigoTipoAposta,
                Numeros          = tipoApostaNeg.GerarNumerosAleatorios().ToArray()
            };

            return(RegistrarNovaAposta(aposta, tipoApostaNeg));
        }
Exemple #5
0
        public void RegistrarNovaApostaTest()
        {
            RegistrarApostaClass apost = new RegistrarApostaClass()
            {
                CodigoTipoAposta = (char)ETipoAposta.MegaSena,
                Numeros          = new int[] { 1, 2, 3, 4, 5, 6 }
            };

            ApostaNeg.RegistrarNovaAposta(apost);

            Assert.Pass();
        }
 public RegistrarApostaClass Surpresinha([FromBody] RegistrarApostaClass aposta)
 {
     try
     {
         return(ApostaNeg.Surpresinha(aposta.CodigoTipoAposta));
     }
     catch (ApostaException ex)
     {
         return(new RegistrarApostaClass()
         {
             MensagemErro = ex.Mensagem
         });
     }
 }
 public RegistrarApostaClass RegistarAposta([FromBody] RegistrarApostaClass aposta)
 {
     try
     {
         return(ApostaNeg.RegistrarNovaAposta(aposta));
     }
     catch (ApostaException ex)
     {
         return(new RegistrarApostaClass()
         {
             MensagemErro = ex.Mensagem
         });
     }
 }
Exemple #8
0
        public void RegistrarNovaApostaErroNumero4()
        {
            RegistrarApostaClass apost = new RegistrarApostaClass()
            {
                CodigoTipoAposta = (char)ETipoAposta.MegaSena,
                Numeros          = new int[] { 1, 2, 3, 4, 5, 90 }
            };

            try
            {
                ApostaNeg.RegistrarNovaAposta(apost);
            }
            catch (ApostaException)
            {
                Assert.Pass();
            }

            Assert.Fail();
        }
Exemple #9
0
        public void RegistrarNovaApostaErroTipo()
        {
            RegistrarApostaClass apost = new RegistrarApostaClass()
            {
                CodigoTipoAposta = 'R',
                Numeros          = new int[] { 1, 2, 3, 4, 5, 6 }
            };

            try
            {
                ApostaNeg.RegistrarNovaAposta(apost);
            }
            catch (ApostaException)
            {
                Assert.Pass();
            }

            Assert.Fail();
        }
Exemple #10
0
        public static RegistrarApostaClass RegistrarNovaAposta(RegistrarApostaClass _aposta, BaseTipoApostaNeg _tipoApostaNeg = null)
        {
            BaseTipoApostaNeg tipoApostaNeg = _tipoApostaNeg ?? BaseTipoApostaNeg.Instanciar(_aposta.CodigoTipoAposta);

            if (ApostasList == null)
            {
                ApostasList = new List <Aposta>();
            }

            Aposta aposta = new Aposta()
            {
                Id         = ApostasList.Count + 1,
                Data       = DateTime.Now,
                Numeros    = _aposta.Numeros?.OrderBy(x => x).ToList(),
                TipoAposta = tipoApostaNeg.TipoAposta
            };

            tipoApostaNeg.ValidarAposta(aposta);

            ApostasList.Add(aposta);

            return(new RegistrarApostaClass(aposta));
        }