private async void ConversionType_SelectedIndexChangedAsync(object sender, EventArgs e) { await _dataPopulator.EnsureDataPopulationAsync(); if (!_dataPopulator.IsPopulated()) { MessageBox.Show("An error has occured!"); return; } ClearInput(); conversionDirection = ConversionType.SelectedIndex == 0 ? ConversionDirection.ToWindows : ConversionDirection.ToIana; switch (conversionDirection) { case ConversionDirection.ToWindows: _dataPopulator.DataEntries.OrderBy(x => x.IANATimeZoneID) .ToList() .ForEach(entry => comboBox2.Items.Add(entry.IANATimeZoneID)); break; case ConversionDirection.ToIana: var distinctEntries = _dataPopulator.DataEntries.Select(x => x.WinTimeZoneID) .Distinct() .OrderBy(x => x).ToList(); distinctEntries.ForEach(entry => comboBox2.Items.Add(entry)); break; } }
public async Task EnsureDataIsPopulatedAsync() { DataPopulator dataPopulator = new DataPopulator(); await dataPopulator.EnsureDataPopulationAsync(); Assert.True(dataPopulator.IsPopulated()); }