/// <summary> /// Asynchronous export item's properties /// </summary> /// <returns>An <see cref="ExportableCI"/> instance containing all relevant properties</returns> public async Task <ExportableCurrentSeasonInfoCI> ExportAsync() { var groupsTask = Groups?.Select(async g => await g.ExportAsync().ConfigureAwait(false)); return(new ExportableCurrentSeasonInfoCI { Id = Id.ToString(), Name = new Dictionary <CultureInfo, string>(Name), Year = Year, StartDate = StartDate, EndDate = EndDate, SeasonCoverage = SeasonCoverage != null ? await SeasonCoverage.ExportAsync().ConfigureAwait(false) : null, Groups = groupsTask != null ? await Task.WhenAll(groupsTask) : null, CurrentRound = CurrentRound != null ? await CurrentRound.ExportAsync().ConfigureAwait(false) : null, Competitors = CompetitorsIds?.Select(s => s.ToString()), Schedule = Schedule?.Select(s => s.ToString()).ToList() }); }
public void OptionalValuesCanBeNull() { var record = RestMessageBuilder.BuildCoverageRecord(null, null, null, int.MinValue, 1, "sr:season:1"); var item = new SeasonCoverage(new SeasonCoverageCI(new SeasonCoverageDTO(record))); record = RestMessageBuilder.BuildCoverageRecord(string.Empty, string.Empty, null, int.MaxValue, 1, "sr:season:1"); item = new SeasonCoverage(new SeasonCoverageCI(new SeasonCoverageDTO(record))); record = RestMessageBuilder.BuildCoverageRecord("test", "test", 0, 0, 1, "sr:season:1"); item = new SeasonCoverage(new SeasonCoverageCI(new SeasonCoverageDTO(record))); record = RestMessageBuilder.BuildCoverageRecord("test", "test", 100, 100, 1, SR.Urn("season").ToString()); item = new SeasonCoverage(new SeasonCoverageCI(new SeasonCoverageDTO(record))); record = RestMessageBuilder.BuildCoverageRecord("test", "test", null, 100, 1, SR.Urn("season").ToString()); item = new SeasonCoverage(new SeasonCoverageCI(new SeasonCoverageDTO(record))); Assert.IsNotNull(item); Assert.AreEqual("test", item.MaxCoverageLevel); Assert.AreEqual("test", item.MinCoverageLevel); Assert.IsNull(item.MaxCovered); Assert.AreEqual(100, item.Played); }