public Task <GroupOperationCost> DoAsync(IStore store, CancellationToken cancellationToken) { return(Task.Run(async() => { var cost = new GroupOperationCost("Aggregate Activities"); foreach (var accountId in NumberRange.ToInts(_config.AccountIds)) { if (cancellationToken.IsCancellationRequested) { break; } var operationCost = await store.GetLatestActivitiesAsync(accountId); cost.StepCosts.Add(operationCost); } return cost; }, cancellationToken)); }
public async Task DoAsync(CancellationToken cancellationToken) { var config = _configProvider.Get <TestLocalizerConfig>(); foreach (var accountId in NumberRange.ToInts(config.AccountIds)) { Console.WriteLine($"Looking for account {accountId}"); var results = await _client.GetActivities(new ActivitiesQuery { AccountId = accountId }); Console.WriteLine($"Account has {results.Total} activities"); foreach (var activity in results.Activities) { Console.Write($"Activity {activity.Id} {activity.Type}"); TryAction(activity, TrySingular, "Singular"); TryAction(activity, TryPlural, "Plural"); Console.WriteLine(); } } }
public async Task DoAsync(CancellationToken cancellationToken) { var config = _configProvider.Get <AggregateQueryConfig>(); foreach (var accountId in NumberRange.ToInts(config.AccountIds)) { var results = await _client.GetLatestActivities(accountId); var tubeStops = results.Aggregates.Count(); if (tubeStops == 0 && config.IgnoreNotFound) { continue; } var activitiesCount = results.Aggregates.Sum(a => a.Count); Console.WriteLine($"Account id {accountId} found {tubeStops} tube stops covering {activitiesCount} activities"); await _resultSaver.Save(results); } }
public void GetInts_GiveAValidValue_ShouldReturnTheExpectedSetOfInts(string definition, NumberRangeOptions options, params int[] expectedSet) { var actualSet = NumberRange.ToInts(definition, options); CheckActualIntSet(expectedSet, actualSet); }