public void Domain_Bolao_Validar_Não_Deveria_Permitir_Sem_Concurso() { _bolao = ObjectMother.GetBolaoSemConcurso(); Action action = () => _bolao.Validar(); action.Should().Throw <InvalidBolaoConcursoException>(); }
public void Domain_Bolao_Validar_Não_Deveria_Permitir_Sem_Apostas() { _bolao = ObjectMother.GetBolaoSemApostas(); Action action = () => _bolao.Validar(); action.Should().Throw <InvalidListApostaException>(); }
public void Test_Boloes_ShouldThrowInvalidBolao() { _bolao = new Bolao(); _bolao.Apostas.Add(_apostas.Object); Action action = () => _bolao.Validar(); action.Should().Throw <BolaoApostasInsuficienteException>(); }
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); }
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); }
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(); } }
public void Domain_Bolao_Validar_Deveria_Ser_Okay() { _bolao = ObjectMother.GetBolao(); _bolao.Validar(); _bolao.apostas.Count().Should().Be(2); }