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 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>(); }