Exemple #1
0
        public void Investimentos_Sumarize_Fundos_Test_1_Ok()
        {
            BasesCalculoConfig basesCalculo = BaseCalguloConfigCarregaro();

            var lista = JsonSerializer.Deserialize <ListaFundos>(fundos_json, JsonHelpers.GetJsonOptions());

            ListaInvestimentos result = lista.CalculaInvestimentos(basesCalculo);

            result.Should().NotBeNull();
            result.ValorTotal.Should().Be(13459.5200m);

            result.Investimentos.Should().NotBeNull();
            result.Investimentos.Should().HaveCount(2);

            result.Investimentos[0].Nome.Should().Be("Fundos ALASKA");
            result.Investimentos[0].ValorInvestido.Should().Be(1000m);
            result.Investimentos[0].ValorTotal.Should().Be(1159m);
            result.Investimentos[0].Vencimento.Should().Be(new DateTime(2022, 10, 01));
            result.Investimentos[0].IR.Should().Be(15.9m);
            result.Investimentos[0].ValorResgate.Should().Be(985.15m);

            result.Investimentos[1].Nome.Should().Be("Fundos REAL");
            result.Investimentos[1].ValorInvestido.Should().Be(10000.0m);
            result.Investimentos[1].ValorTotal.Should().Be(12300.52m);
            result.Investimentos[1].Vencimento.Should().Be(new DateTime(2022, 11, 15));
            result.Investimentos[1].IR.Should().Be(230.052m);
            result.Investimentos[1].ValorResgate.Should().Be(8610.364m);
        }
Exemple #2
0
        public void Investimentos_Sumarize_RendaFixa_Test_1_Ok()
        {
            BasesCalculoConfig basesCalculo = BaseCalguloConfigCarregaro();

            var lista = JsonSerializer.Deserialize <ListaRendaFixa>(renda_fixa_json, JsonHelpers.GetJsonOptions());

            ListaInvestimentos result = lista.CalculaInvestimentos(basesCalculo);

            result.Should().NotBeNull();
            result.ValorTotal.Should().Be(7607.61m);

            result.Investimentos.Should().NotBeNull();
            result.Investimentos.Should().HaveCount(2);

            result.Investimentos[0].Nome.Should().Be("LCI 97% do CDI - BANCO MAXIMA");
            result.Investimentos[0].ValorInvestido.Should().Be(2000.0m);
            result.Investimentos[0].ValorTotal.Should().Be(2097.85m);
            result.Investimentos[0].Vencimento.Should().Be(new DateTime(2021, 03, 09));
            result.Investimentos[0].IR.Should().Be(9.785m);
            result.Investimentos[0].ValorResgate.Should().Be(2097.85m);

            result.Investimentos[1].Nome.Should().Be("LCI 97% do CDI - BANCO BARI");
            result.Investimentos[1].ValorInvestido.Should().Be(5000.0m);
            result.Investimentos[1].ValorTotal.Should().Be(5509.76m);
            result.Investimentos[1].Vencimento.Should().Be(new DateTime(2021, 03, 09));
            result.Investimentos[1].IR.Should().Be(50.976m);
            result.Investimentos[1].ValorResgate.Should().Be(5509.76m);
        }
Exemple #3
0
        public void Investimentos_Sumarize_TesouroDireto_Test_2_Ok()
        {
            BasesCalculoConfig basesCalculo = BaseCalguloConfigCarregaro();

            var lista = JsonSerializer.Deserialize <ListaTesouroDireto>(tesouro_direto_json, JsonHelpers.GetJsonOptions());
            ListaInvestimentos result = lista.CalculaInvestimentos(basesCalculo);

            result.Should().NotBeNull();
            result.ValorTotal.Should().Be(1332.4670m);

            result.Investimentos.Should().NotBeNull();
            result.Investimentos.Should().HaveCount(2);

            result.Investimentos[0].Nome.Should().Be("Tesouro Selic 2025");
            result.Investimentos[0].ValorInvestido.Should().Be(799.4720m);
            result.Investimentos[0].ValorTotal.Should().Be(829.68m);
            result.Investimentos[0].Vencimento.Should().Be(new DateTime(2025, 03, 01));
            result.Investimentos[0].IR.Should().Be(3.0208m);
            result.Investimentos[0].ValorResgate.Should().Be(705.228m);

            result.Investimentos[1].Nome.Should().Be("Tesouro IPCA 2035");
            result.Investimentos[1].ValorInvestido.Should().Be(467.1470m);
            result.Investimentos[1].ValorTotal.Should().Be(502.787m);
            result.Investimentos[1].Vencimento.Should().Be(new DateTime(2020, 02, 01));
            result.Investimentos[1].IR.Should().Be(3.56400m);
            result.Investimentos[1].ValorResgate.Should().Be(502.787m);
        }
        public override Investimento CalculaInvestimento(BasesCalculoConfig basesCalculo)
        {
            decimal ir           = CalculaIr(basesCalculo.TaxaSobreRentabilidadeIR.TesouroDireto);
            decimal valorResgate = CalcularValorResgate(basesCalculo.RegrasDeResgate);

            return(new Investimento(
                       nome: $"{this.Tipo} {this.Indice} - {this.Nome}",
                       valorInvestido: this.CapitalInvestido,
                       valorTotal: this.CapitalAtual,
                       vencimento: this.Vencimento,
                       iR: ir,
                       valorResgate: valorResgate
                       ));
        }
Exemple #5
0
        public void Investimentos_Sumarize_TesouroDireto_Test_1_Ok()
        {
            BasesCalculoConfig basesCalculo = BaseCalguloConfigCarregaro();

            string tesouro_direto = File.ReadAllText("Unit/json-mock/tesouro_direto_teste1.json");
            var    lista          = JsonSerializer.Deserialize <ListaTesouroDireto>(tesouro_direto, JsonHelpers.GetJsonOptions());

            ListaInvestimentos result = lista.CalculaInvestimentos(basesCalculo);

            result.Should().NotBeNull();
            result.ValorTotal.Should().Be(829.68m);

            result.Investimentos.Should().NotBeNull();
            result.Investimentos.Should().HaveCount(1);

            result.Investimentos[0].Nome.Should().Be("Tesouro Selic 2025");
            result.Investimentos[0].ValorInvestido.Should().Be(799.4720m);
            result.Investimentos[0].ValorTotal.Should().Be(829.68m);
            result.Investimentos[0].Vencimento.Should().Be(new DateTime(2025, 03, 01));
            result.Investimentos[0].IR.Should().Be(3.0208m);
            result.Investimentos[0].ValorResgate.Should().Be(705.228m);
        }
Exemple #6
0
 public abstract Investimento CalculaInvestimento(BasesCalculoConfig basesCalculo);
Exemple #7
0
 public override Investimento CalculaInvestimento(BasesCalculoConfig basesCalculo)
 {
     throw new NotImplementedException();
 }