public async Task Should_be_valid_when_external_apis_return_200() { var expectedTdsDto = new TdsDto() { Tds = new List <Td>() }; var expectedLcisDto = new LcisDto() { Lcis = new List <Lci>() }; var expectedFundsDto = new FundsDto() { Funds = new List <Fund>() }; _mockInvestimentService.Setup(x => x.GetTdsAsync(It.IsAny <string>())).ReturnsAsync(expectedTdsDto); _mockInvestimentService.Setup(x => x.GetLcisAsync(It.IsAny <string>())).ReturnsAsync(expectedLcisDto); _mockInvestimentService.Setup(x => x.GetFundsAsync(It.IsAny <string>())).ReturnsAsync(expectedFundsDto); var result = await _portfolio.GetAsync(); result.Should().BeOfType <InvestmentsResponse>(); result.TotalValue.Should().Equals(expectedTdsDto.Tds.Sum(x => x.TotalValue) + expectedLcisDto.Lcis.Sum(x => x.TotalValue) + expectedFundsDto.Funds.Sum(x => x.TotalValue)); result.Investments.Should().NotBeNull(); }
public InvestmentsDto ReturnInvestments() { InvestmentsDto investments = new InvestmentsDto { Investments = new List <Investment.Dto.Investment> { } }; TreasuriesDto treasuriesDto = _client.Get <TreasuriesDto>($"v2/5e3428203000006b00d9632a").Result; FixedIncomeDto fixedIncomeDto = _client.Get <FixedIncomeDto>($"v2/5e3429a33000008c00d96336").Result; FundsDto fundsDto = _client.Get <FundsDto>($"v2/5e342ab33000008c00d96342").Result; TreasurieIterations(investments, treasuriesDto); FixedIncomeIterations(investments, fixedIncomeDto); FundIterations(investments, fundsDto); return(investments); }
public async Task Should_be_return_portfolio_when_external_apis_return_200() { var tdsDto = new TdsDto { Tds = new List <Td>() }; var lcisDto = new LcisDto { Lcis = new List <Lci>() }; var fundsDto = new FundsDto { Funds = new List <Fund>() }; _mockPortfolio.Setup(x => x.GetAsync()).ReturnsAsync(InvestmentsResponse); var handler = new InvestimentsHandler(_mockPortfolio.Object, _cache, _mockTracer.Object); var response = await handler.Handle(new InvestmentsRequest(), CancellationToken.None); response.Result.Should().NotBeNull(); response.Valid.Should().BeTrue(); response.Result.Should().BeOfType <InvestmentsResponse>(); }