Example #1
0
        public void Domain_Bolao_Validar_Não_Deveria_Permitir_Sem_Concurso()
        {
            _bolao = ObjectMother.GetBolaoSemConcurso();
            Action action = () => _bolao.Validar();

            action.Should().Throw <InvalidBolaoConcursoException>();
        }
Example #2
0
        public void Domain_Bolao_Validar_Não_Deveria_Permitir_Sem_Apostas()
        {
            _bolao = ObjectMother.GetBolaoSemApostas();
            Action action = () => _bolao.Validar();

            action.Should().Throw <InvalidListApostaException>();
        }
Example #3
0
        public void Test_Boloes_ShouldThrowInvalidBolao()
        {
            _bolao = new Bolao();
            _bolao.Apostas.Add(_apostas.Object);

            Action action = () => _bolao.Validar();

            action.Should().Throw <BolaoApostasInsuficienteException>();
        }
Example #4
0
        public void Test_Boloes_ShouldValidBolao()
        {
            _bolao = new Bolao();
            _bolao.Apostas.Add(_apostas.Object);
            _bolao.Apostas.Add(_apostas.Object);

            Action action = () => _bolao.Validar();

            action.Should().NotThrow();
            _bolao.Apostas.Should().HaveCount(2);
        }
Example #5
0
        public Bolao Adicionar(Bolao entidade)
        {
            entidade.Validar();

            long _id = Db.Insert(_insert, Take(entidade));

            foreach (var aposta in entidade.Apostas)
            {
                Db.Insert(_insertAposta, TakeAposta(aposta, _id));
            }

            entidade = ObterPorId(Convert.ToInt32(_id));

            return(entidade);
        }
Example #6
0
        public void Deletar(Bolao entidade)
        {
            if (entidade.Id == 0)
            {
                throw new IdentifierUndefinedException();
            }

            entidade.Validar();

            try
            {
                Db.Delete(_delete, Take(entidade));
            }
            catch (SqlException)
            {
                throw new DependenciaException();
            }
        }
Example #7
0
 public void Domain_Bolao_Validar_Deveria_Ser_Okay()
 {
     _bolao = ObjectMother.GetBolao();
     _bolao.Validar();
     _bolao.apostas.Count().Should().Be(2);
 }