Beispiel #1
0
        public async Task <CustomerList> GetCustomers()
        {
            var customers = await _apiClient.GetCustomers();

            var bets = await _apiClient.GetBets();

            return(new CustomerList
            {
                TotalAmountBet = bets.Sum(b => b.Stake),
                Customers = customers.Select(c =>
                {
                    var customerBets = bets.Where(b => b.CustomerId == c.Id).ToList();

                    return new Customer
                    {
                        Id = c.Id,
                        TotalBets = customerBets.Count,
                        TotalAmountBet = customerBets.Sum(b => b.Stake),
                        IsRisky = customerBets.Any(b => b.Stake > _riskThreshold)
                    };
                }).ToList()
            });
        }
Beispiel #2
0
        public async Task CanGetCustomers()
        {
            var customers = await _apiClient.GetCustomers();

            Assert.IsTrue(customers.Any());
        }