//Get para pegar as propriedades atribuir valores e mostrar depois public InvestimentList <DirectTreasure> Get() { //Nova instancia de lista de tesouro direto var directTreasureList = new InvestimentList <DirectTreasure>(); //Intanciando radom para valores aleatorios Random random = new Random(); //Gerando 6 tesouro direto for (int i = 0; i < 6; i++) { var valuesinitials = Enum.GetNames(typeof(InitialsTypeDirectTreasure)); var type = Enum.GetNames(typeof(TypeDirectTreasure)); //Nova instancia de tesouro direto DirectTreasure directTreasure = new DirectTreasure(); directTreasure.Name = $"Tesouro direto{i + 1}"; directTreasure.Description = $"Descrição teste{i + 1}"; directTreasure.MonthlyProfitability = random.Next(1, 45); directTreasure.Initials = valuesinitials[random.Next(valuesinitials.Length)]; directTreasure.Price = random.NextDouble() * 200; directTreasure.TypeDirectTreasure = type[random.Next(type.Length)]; directTreasureList.SetInvestment(directTreasure); } //Retornando a lista return(directTreasureList); }
public InvestimentList <Investments> Get() { // Intancia de uma nova lista de investimentos (InvestimentList) var investimentList = new InvestimentList <Investments>(); // Intanciando a classe Random para gerar valores de rentabilidade aleatorios e siglas aleatorias; Random random = new Random(); //Gerando nova lista de investimentos com 6 for (int i = 0; i < 6; i++) { //Intanciando classes de investimentos var directTreasure = new DirectTreasure(); var investmentFunds = new InvestmentFunds(); var stockExchangeShares = new StockExchangeShares(); //Adicionando suas caracteristicas var initialsStockEx = Enum.GetNames(typeof(InitialsStockExchangeShare)); stockExchangeShares.Name = $"Ação{i}"; stockExchangeShares.MonthlyProfitability = random.Next(10, 50); stockExchangeShares.Initials = initialsStockEx[random.Next(initialsStockEx.Length)]; stockExchangeShares.Description = "Ação teste"; investmentFunds.Name = $"Fundo de Investimento{i + 1}"; investmentFunds.MonthlyProfitability = 21; investmentFunds.Description = "Teste Descrição"; investmentFunds.Initials = "SLA"; var valuesinitials = Enum.GetNames(typeof(InitialsTypeDirectTreasure)); directTreasure.Name = $"Tesouro direto{i + 1}"; directTreasure.Description = $"Descrição teste{i + 1}"; directTreasure.MonthlyProfitability = random.Next(1, 45); directTreasure.Initials = valuesinitials[random.Next(valuesinitials.Length)]; investimentList.SetInvestment(stockExchangeShares); investimentList.SetInvestment(directTreasure); investimentList.SetInvestment(investmentFunds); } return(investimentList); }