Example #1
0
 public void Domain_FaturamentoLoterica_Calcular_Faturamento_Lucro()
 {
     _faturamento = Loterica.Common.Tests.Lotericas.ObjectMother.GetFaturamento();
     _faturamento.CalcularFaturamentoELucro(10, 2);
     _faturamento.lucro.Should().Be(3.30);
     _faturamento.faturamento.Should().Be(30.30);
 }
Example #2
0
        public void Integration_EditarFaturamentoLoterica_Corretamente()
        {
            FaturamentoLoterica faturamentoLoterica = Loterica.Common.Tests.Lotericas.ObjectMother.GetFaturamentoComId();

            faturamentoLoterica.CalcularFaturamentoELucro(10, 2);
            _service.Editar(faturamentoLoterica);
            FaturamentoLoterica f = _service.Get(faturamentoLoterica.Id);

            f.lucro.Should().Be(faturamentoLoterica.lucro);
        }
Example #3
0
        public void Service_FaturamentoLoterica_Nao_Deve_Editar_Caso_Nao_Passe_Na_Validacao()
        {
            _faturamentoLoterica = Loterica.Common.Tests.Lotericas.ObjectMother.GetFaturamentoComId();
            _faturamentoLoterica.CalcularFaturamentoELucro(100, 10);
            _faturamentoLoterica.lucro = 1000;

            Action action = () => _service.Editar(_faturamentoLoterica);

            action.Should().Throw <InvalidFaturamentoException>();
            _faturamentoLotericaRepository.VerifyNoOtherCalls();
        }
Example #4
0
        public void Service_FaturamentoLoterica_Deveria_Chamar_Excluir_Faturamento_do_Repository()
        {
            _faturamentoLoterica = Loterica.Common.Tests.Lotericas.ObjectMother.GetFaturamentoComId();
            _faturamentoLoterica.CalcularFaturamentoELucro(100, 10);

            _faturamentoLotericaRepository
            .Setup(x => x.Excluir(It.IsAny <int>()));

            _service.Excluir(_faturamentoLoterica);

            _faturamentoLotericaRepository.Verify(x => x.Excluir(_faturamentoLoterica.Id));
        }
Example #5
0
        public void Service_FaturamentoLoterica_Deveria_Editar_Faturamento()
        {
            _faturamentoLoterica = Loterica.Common.Tests.Lotericas.ObjectMother.GetFaturamentoComId();
            _faturamentoLoterica.CalcularFaturamentoELucro(100, 10);

            _faturamentoLotericaRepository
            .Setup(x => x.Editar(It.IsAny <FaturamentoLoterica>()));

            _service.Editar(_faturamentoLoterica);

            _faturamentoLotericaRepository.Verify(x => x.Editar(_faturamentoLoterica));
        }
Example #6
0
        public void Service_FaturamentoLoterica_Deveria_Chamar_GetByConcursoId_do_Repository()
        {
            _faturamentoLoterica = Loterica.Common.Tests.Lotericas.ObjectMother.GetFaturamentoComId();
            _faturamentoLoterica.CalcularFaturamentoELucro(1000, 10);

            _faturamentoLotericaRepository
            .Setup(x => x.GetByConcursoId(It.IsAny <int>()))
            .Returns(_faturamentoLoterica);

            FaturamentoLoterica faturamentoRecebido = _service.GetByConcursoId(_faturamentoLoterica.concurso.Id);

            _faturamentoLotericaRepository
            .Verify(x => x.GetByConcursoId(_faturamentoLoterica.concurso.Id));

            faturamentoRecebido.Should().BeEquivalentTo(_faturamentoLoterica);
        }
Example #7
0
        public void Service_FaturamentoLoterica_Deveria_Adicionar_Faturamento()
        {
            _faturamentoLoterica = Loterica.Common.Tests.Lotericas.ObjectMother.GetFaturamento();
            _faturamentoLoterica.CalcularFaturamentoELucro(100, 10);

            _faturamentoLotericaRepository
            .Setup(x => x.Adicionar(It.IsAny <FaturamentoLoterica>()))
            .Returns(
                new FaturamentoLoterica(_faturamentoLoterica.concurso)
            {
                Id          = 1,
                faturamento = _faturamentoLoterica.faturamento,
                lucro       = _faturamentoLoterica.lucro
            });

            _service.Adicionar(_faturamentoLoterica);

            _faturamentoLotericaRepository.Verify(x => x.Adicionar(_faturamentoLoterica));
        }