コード例 #1
0
        public void Test_ExecuteAsync_With_AggregateCommand_Calls_AggregationService_AggregateAsync()
        {
            _commandHandler.ExecuteAsync("aggregate");

            A.CallTo(() => _aggregationService.AggregateAsync()).MustHaveHappenedOnceExactly();
            A.CallTo(() => _downloadService.DownloadAsync(A <string[]> ._)).MustNotHaveHappened();
            A.CallTo(() => _importService.ImportAsync()).MustNotHaveHappened();
        }
コード例 #2
0
        public virtual async Task ExecuteAsync(string command)
        {
            switch (command)
            {
            case "aggregate":
                await _aggregationService.AggregateAsync();

                break;

            case "download":
                // TODO: config variable?  user input?
                var cities = new[]
                {
                    "des moines", "johnston", "norwalk", "cedar rapids", "council bluffs", "davenport",
                    "fort dodge", "mason city", "sioux city", "altoona"
                };
                await _downloadService.DownloadAsync(cities);

                break;

            case "import":
                await _importService.ImportAsync();

                break;
            }
        }