public async Task LoadPlanners(ListView plannerList, string groupId) { // C# 8.0 Preview 2 feature. using var cs = this.GetCodeSection(); if (plannerList == null || string.IsNullOrWhiteSpace(groupId)) { cs.Warning(Constants.MESSAGE_WARNING_NULLARGUMENTS); return; } plannerList.ItemsSource = null; IEnumerable <PlannerPlan> planners; try { var pApi = TeamsFactory.GetStaticApi("PlannerApi", this.token) as PlannerApi; planners = await pApi.GetPlanners(groupId); } catch (Exception ex) { cs.Exception(ex); InfoText.Text = Constants.MESSAGE_ERROR_GENERIC + " " + ex.Message; throw; } plannerList.ItemsSource = planners?.ToList(); }
public void ThereShouldBe30Teams() { var seasons = new[] { 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 }; foreach (var season in seasons) { TeamsFactory.GetTeamsBySeason(new Season(season)).Count.Should().Be(30); } }
private async Task CopyPlanner(string sPlanId, string dPlanId) { // C# 8.0 Preview 2 feature. using var cs = this.GetCodeSection(); var pApi = TeamsFactory.GetStaticApi("PlannerApi", this.token) as PlannerApi; // Get Source/Dest Planner details. PlannerPlanDetails sPlanDetails; PlannerPlanDetails dPlanDetails; try { cs.Debug($"Get Planner details for: {sPlanId}."); cs.Debug($"Get Planner details for: {dPlanId}."); sPlanDetails = await pApi.GetPlannerDetails(sPlanId); dPlanDetails = await pApi.GetPlannerDetails(dPlanId); // Update Dest Planner details. cs.Debug($"Update planner details: {dPlanId}."); await pApi.UpdatePlannerDetails(dPlanId, dPlanDetails.ETag, sPlanDetails.CategoryDescriptions, dPlanDetails.SharedWith); } catch (Exception ex) { cs.Exception(ex); throw; } try { // Get Source Planner Buckets. var sBuckets = await pApi.GetBuckets(sPlanId); // Get Source Planner Tasks. var sTasks = await pApi.GetTasks(sPlanId); // Clear Destination Planner. var dBuckets = await pApi.GetBuckets(dPlanId); var bApi = TeamsFactory.GetStaticApi("BucketApi", this.token) as BucketApi; foreach (var bucket in dBuckets) { await bApi.DeleteBucket(bucket.Id, bucket.ETag); } await pApi.CreateBucketsAndTasks(dPlanId, sBuckets, sTasks); } catch (Exception ex) { cs.Exception(ex); throw; } }
public async Task LoadChannels(string teamId) { if (string.IsNullOrWhiteSpace(teamId)) { return; } ComboBox_Channels.ItemsSource = null; var cApi = TeamsFactory.GetStaticApi("ChannelApi", this.token) as ChannelApi; var channels = await cApi.GetChannels(teamId); ComboBox_Channels.ItemsSource = channels; }
//[InlineData(2018)] //[InlineData(2017)] //[InlineData(2016)] //[InlineData(2015)] //[InlineData(2014)] //[InlineData(2013)] //[InlineData(2012)] //[InlineData(2011)] //[InlineData(2010)] public async Task ProcessData(int seasonStartYear) { var season = new Season(seasonStartYear); await ExecuteTest(async c => { var provider = c.GetInstance <ITeamProvider>(); var processor = c.GetInstance <ITeamProcessor>(); foreach (var team in TeamsFactory.GetTeamsBySeason(season)) { var teamData = await provider.GetTeamData(team, season); await processor.Process(team, season, teamData); //await Task.Delay(TimeSpan.FromSeconds(3)); } }); }
public async Task LoadTeams() { // C# 8.0 Preview 2 feature. using var cs = this.GetCodeSection(); ComboBox_Teams_Source.ItemsSource = ComboBox_Teams_Dest.ItemsSource = null; PlannerSourceList.ItemsSource = PlannerDestinationList.ItemsSource = null; cs.Debug("Get TeamApi."); IEnumerable <Team> teams = null; try { var tApi = TeamsFactory.GetStaticApi("TeamApi", this.token) as TeamApi; teams = await tApi.GetJoinedTeams(); } catch (Exception ex) { cs.Exception(ex); InfoText.Text = Constants.MESSAGE_ERROR_GENERIC + " " + ex.Message; } ComboBox_Teams_Source.ItemsSource = ComboBox_Teams_Dest.ItemsSource = teams; }