Пример #1
0
        public float Resgate(InvestimentoConta investimentoConta, DateTime dataResgate)
        {
            var valor = InvestimentoOPS.Resgate(investimentoConta, dataResgate);

            if (new ContaDAO().Transferir(new ContaDAO().PesquisarContaPorNumero(1),
                                          investimentoConta.Conta, (float)valor, "Resgate de investimento") != null)
            {
                if (AtualizaInvestimentoConta(investimentoConta, dataResgate, (float)valor) != null)
                {
                    return((float)valor);
                }
            }

            return(-1);
        }
        public void TestInvestimentoOPS1()
        {
            Taxa taxa = new Taxa()
            {
                Id    = 1,
                Nome  = "Taxa louca",
                Valor = 12
            };

            Investimento investimento = new Investimento()
            {
                Nome          = "Tesouro Direto",
                PreFixada     = true,
                Rentabilidade = 4,
                Taxa          = taxa,
            };

            ContaCorrente conta = new ContaCorrente()
            {
                Limite        = 1000,
                Emprestimos   = null,
                Investimentos = null,
                Numero        = 1213,
                Pessoa        = null,
                Saldo         = 1500,
                Senha         = "1234"
            };

            InvestimentoConta investimentoConta = new InvestimentoConta()
            {
                Conta        = conta,
                Investimento = investimento,
                Valor        = 1000,
                DataInicio   = DateTime.Now,
                DataFim      = DateTime.Now.AddYears(1)
            };
            double saidaDouble = InvestimentoOPS.Resgate(investimentoConta, DateTime.Now.AddMonths(3));

            Console.Write(saidaDouble);
            int saidaInt = Convert.ToInt32(saidaDouble);

            Assert.AreEqual(955, saidaInt);
        }
Пример #3
0
 public float SimulaResgate(InvestimentoConta investimentoConta, DateTime dataResgate)
 {
     return((float)InvestimentoOPS.Resgate(investimentoConta, dataResgate));
 }