/// <summary> /// Builds a race trace. /// </summary> /// <param name="raceData">The race data.</param> /// <param name="referenceTime">The reference time.</param> /// <param name="driverTeamLookup">The driver team lookup.</param> /// <returns>An instance of <see cref="TraceData"/> class.</returns> internal TraceData Build(RaceData raceData, ReferenceTime referenceTime, IReadOnlyDictionary <DriverCode, string> driverTeamLookup) { Guard.Argument(raceData, nameof(raceData)).NotNull(); Guard.Argument(referenceTime, nameof(referenceTime)).NotNull(); Guard.Argument(driverTeamLookup, nameof(driverTeamLookup)).NotNull().NotEmpty(); return(BuildTraceData(raceData, referenceTime, driverTeamLookup)); }
private static TraceData BuildTraceData(RaceData raceData, ReferenceTime referenceTime, IReadOnlyDictionary <DriverCode, string> driverTeamLookup) { var raceDataCollection = raceData.AllDriverRaceData; var driverTraces = raceDataCollection.Select(x => BuildTraceForDriver(x, referenceTime, driverTeamLookup[x.DriverCode])) .ToArray(); return(new TraceData(driverTraces)); }