Example #1
0
        public void Investir(Fundo fundo, decimal valorInvestido)
        {
            InvestimentoService investimento = new InvestimentoService(this, valorInvestido, fundo);

            if (investimento.isValid())
            {
                Movimentacoes.Add(investimento.Movimentacao);
            }
        }
Example #2
0
        public void Aplicar(Movimentacao movimentacao)
        {
            var pessoa = PessoaRepository.FindByCpf(movimentacao.Pessoa.Cpf);
            var fundo  = FundoRepository.FindById(movimentacao.Fundo.Id);
            InvestimentoService investimento = new InvestimentoService(pessoa, movimentacao.ValorInvestido, fundo);

            if (investimento.isValid())
            {
                MovimentoRepository.Insert(investimento.Movimentacao);
            }
        }
        public void InvestirMenorQueMinimoInicial()
        {
            InvestimentoService investimento = new InvestimentoService(Investidor, 500.00M, CopacabanaTrial);
            Exception           ex           = Assert.Throws <DomainServiceException>(delegate { investimento.isValid(); });

            Assert.AreEqual(ex.Message, Resources.Dicionario.VALOR_INVESTIDO_SERA_MAIOR_MINIMO_EXIGIDO);
        }
        public void InvestirIgualAMinimoInicial()
        {
            InvestimentoService investimento = new InvestimentoService(Investidor, 1000.00M, CopacabanaTrial);

            Assert.IsTrue(investimento.isValid());
        }