diff --git a/src/Aydsko.iRacingData.UnitTests/CapturedResponseValidationTests.cs b/src/Aydsko.iRacingData.UnitTests/CapturedResponseValidationTests.cs index 39c3956..5481e22 100644 --- a/src/Aydsko.iRacingData.UnitTests/CapturedResponseValidationTests.cs +++ b/src/Aydsko.iRacingData.UnitTests/CapturedResponseValidationTests.cs @@ -692,21 +692,46 @@ public async Task GetSubSessionResultSuccessfulAsync() var subSessionResultResponse = await sut.GetSubSessionResultAsync(12345, false, CancellationToken.None).ConfigureAwait(false); - Assert.That(subSessionResultResponse, Is.Not.Null); - Assert.That(subSessionResultResponse!.Data, Is.Not.Null); - - Assert.That(subSessionResultResponse.Data.SeasonId, Is.EqualTo(3620)); - Assert.That(subSessionResultResponse.Data.SeriesName, Is.EqualTo("Global Fanatec Challenge")); - Assert.That(subSessionResultResponse.Data.SessionResults, Has.Length.EqualTo(2)); - Assert.That(subSessionResultResponse.Data.SessionResults, Has.One.Property(nameof(SessionResults.SimSessionName)).EqualTo("RACE")); - - var raceResults = subSessionResultResponse.Data.SessionResults.Single(r => r.SimSessionName == "RACE"); - Assert.That(raceResults.Results, Has.All.Property(nameof(Result.DriverResults)).Null); // Single-driver events don't have driver results. - - Assert.That(subSessionResultResponse.RateLimitRemaining, Is.EqualTo(99)); - Assert.That(subSessionResultResponse.TotalRateLimit, Is.EqualTo(100)); - Assert.That(subSessionResultResponse.RateLimitReset, Is.EqualTo(new DateTimeOffset(2022, 2, 10, 0, 0, 0, TimeSpan.Zero))); - Assert.That(subSessionResultResponse.DataExpires, Is.EqualTo(new DateTimeOffset(2022, 8, 27, 11, 23, 19, 507, TimeSpan.Zero))); + Assert.Multiple(() => + { + Assert.That(subSessionResultResponse, Is.Not.Null); + Assert.That(subSessionResultResponse!.Data, Is.Not.Null); + + var subSessionResult = subSessionResultResponse.Data; + Assert.That(subSessionResult.SeasonId, Is.EqualTo(3620)); + Assert.That(subSessionResult.SeriesName, Is.EqualTo("Global Fanatec Challenge")); + Assert.That(subSessionResult.SessionResults, Has.Length.EqualTo(2)); + Assert.That(subSessionResult.SessionResults, Has.One.Property(nameof(SessionResults.SimSessionName)).EqualTo("RACE")); + Assert.That(subSessionResult.NumberOfDrivers, Is.EqualTo(19)); + Assert.That(subSessionResult.EventAverageLap, Is.EqualTo(TimeSpan.FromSeconds(407.8532))); + Assert.That(subSessionResult.EventBestLapTime, Is.EqualTo(TimeSpan.FromSeconds(408.2271))); + + var raceResults = subSessionResult.SessionResults.Single(r => r.SimSessionName == "RACE"); + Assert.That(raceResults.Results, Has.All.Property(nameof(Result.DriverResults)).Null); // Single-driver events don't have driver results. + + var sampleDriver = raceResults.Results.FirstOrDefault(r => r.Position == 0); + Assert.That(sampleDriver, Is.Not.Null); + Assert.That(sampleDriver!.CarClassName, Is.EqualTo("Cadillac CTS-VR")); + Assert.That(sampleDriver.CarClassShortName, Is.EqualTo("Cadillac CTS-VR")); + Assert.That(sampleDriver.CarName, Is.EqualTo("Cadillac CTS-V Racecar")); + Assert.That(sampleDriver.DivisionName, Is.EqualTo("Division 1")); + + Assert.That(subSessionResult.Weather, Is.Not.Null); + + var weather = subSessionResult.Weather; + Assert.That(weather.SimulatedStart, Is.EqualTo(new DateTime(2022, 04, 02, 18, 25, 00))); + Assert.That(weather.AllowFog, Is.EqualTo(false)); + Assert.That(weather.PrecipitationOption, Is.EqualTo(0)); + + Assert.That(subSessionResult.SessionSplits, Has.Length.EqualTo(2)); + Assert.That(subSessionResult.SessionSplits, Contains.Item(new SessionSplit { SubSessionId = 45243121, EventStrengthOfField = 1683 })); + Assert.That(subSessionResult.SessionSplits, Contains.Item(new SessionSplit { SubSessionId = 45243122, EventStrengthOfField = 1143 })); + + Assert.That(subSessionResultResponse.RateLimitRemaining, Is.EqualTo(99)); + Assert.That(subSessionResultResponse.TotalRateLimit, Is.EqualTo(100)); + Assert.That(subSessionResultResponse.RateLimitReset, Is.EqualTo(new DateTimeOffset(2022, 2, 10, 0, 0, 0, TimeSpan.Zero))); + Assert.That(subSessionResultResponse.DataExpires, Is.EqualTo(new DateTimeOffset(2022, 8, 27, 11, 23, 19, 507, TimeSpan.Zero))); + }); } [Test(TestOf = typeof(DataClient))] diff --git a/src/Aydsko.iRacingData.UnitTests/Responses/GetSubSessionResultSuccessfulAsync/2.json b/src/Aydsko.iRacingData.UnitTests/Responses/GetSubSessionResultSuccessfulAsync/2.json index 54f39be..8f31ffb 100644 --- a/src/Aydsko.iRacingData.UnitTests/Responses/GetSubSessionResultSuccessfulAsync/2.json +++ b/src/Aydsko.iRacingData.UnitTests/Responses/GetSubSessionResultSuccessfulAsync/2.json @@ -10,7 +10,7 @@ "series_id": 210, "series_name": "Global Fanatec Challenge", "series_short_name": "Global Fanatec Challenge", - "series_logo": "fanatecglobalchallenge-logo.png", + "series_logo": "seriesid_210.png", "race_week_num": 2, "session_id": 174387186, "license_category_id": 2, @@ -34,17 +34,29 @@ "points_type": "race", "event_strength_of_field": 1683, "event_average_lap": 4078532, + "event_best_lap_time": 4082271, "event_laps_complete": 4, + "num_drivers": 19, "num_cautions": 0, "num_caution_laps": 0, "num_lead_changes": 0, "official_session": true, "heat_info_id": -1, + "session_splits": [ + { + "subsession_id": 45243121, + "event_strength_of_field": 1683 + }, + { + "subsession_id": 45243122, + "event_strength_of_field": 1143 + } + ], "special_event_type": -1, "damage_model": 0, "can_protest": false, - "cooldown_minutes": 0, - "limit_minutes": 0, + "cooldown_minutes": 30, + "limit_minutes": 10080, "track": { "track_id": 249, "track_name": "Nürburgring Nordschleife", @@ -65,8 +77,11 @@ "weather_var_initial": 0, "weather_var_ongoing": 0, "time_of_day": 2, - "simulated_start_utc_time": "2022-04-02T16:25:00Z", - "simulated_start_utc_offset": 120 + "allow_fog": false, + "precip_option": 0, + "track_water": 0, + "version": 0, + "simulated_start_time": "2022-04-02T18:25:00" }, "track_state": { "leave_marbles": false, @@ -115,11 +130,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 34, "club_name": "Australia/NZ", "club_shortname": "Australia/NZ", "division": 0, - "division_name": "Diamond Division", + "division_name": "Division 1", "old_license_level": 20, "old_sub_level": 458, "old_cpi": 103.9162, @@ -139,6 +156,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 132, "livery": { "car_id": 41, @@ -203,11 +221,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 29, "club_name": "Midwest", "club_shortname": "Midwest", "division": 1, - "division_name": "Gold Division", + "division_name": "Division 2", "old_license_level": 14, "old_sub_level": 293, "old_cpi": 42.26631, @@ -227,6 +247,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 105, "livery": { "car_id": 41, @@ -291,11 +312,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 30, "club_name": "Texas", "club_shortname": "Texas", "division": 3, - "division_name": "Bronze Division", + "division_name": "Division 4", "old_license_level": 7, "old_sub_level": 343, "old_cpi": 20.96678, @@ -315,6 +338,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 66, "livery": { "car_id": 41, @@ -379,11 +403,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 45, "club_name": "Brazil", "club_shortname": "Brazil", "division": 1, - "division_name": "Gold Division", + "division_name": "Division 2", "old_license_level": 15, "old_sub_level": 334, "old_cpi": 41.450016, @@ -403,6 +429,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 118, "livery": { "car_id": 41, @@ -467,11 +494,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 24, "club_name": "Hispanoamérica", "club_shortname": "Hispanoamérica", "division": 2, - "division_name": "Silver Division", + "division_name": "Division 3", "old_license_level": 15, "old_sub_level": 367, "old_cpi": 51.642273, @@ -491,6 +520,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 26, "livery": { "car_id": 41, @@ -555,11 +585,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 15, "club_name": "Canada", "club_shortname": "Canada", "division": 2, - "division_name": "Silver Division", + "division_name": "Division 3", "old_license_level": 16, "old_sub_level": 418, "old_cpi": 54.10679, @@ -579,6 +611,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 52, "livery": { "car_id": 41, @@ -643,11 +676,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 43, "club_name": "Scandinavia", "club_shortname": "Scandinavia", "division": 3, - "division_name": "Bronze Division", + "division_name": "Division 4", "old_license_level": 15, "old_sub_level": 390, "old_cpi": 60.17846, @@ -667,6 +702,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 92, "livery": { "car_id": 41, @@ -731,11 +767,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 49, "club_name": "Mexico", "club_shortname": "Mexico", "division": 1, - "division_name": "Gold Division", + "division_name": "Division 2", "old_license_level": 14, "old_sub_level": 249, "old_cpi": 31.632631, @@ -755,6 +793,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 79, "livery": { "car_id": 41, @@ -819,11 +858,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 32, "club_name": "West", "club_shortname": "West", "division": 2, - "division_name": "Silver Division", + "division_name": "Division 3", "old_license_level": 20, "old_sub_level": 433, "old_cpi": 88.018936, @@ -843,6 +884,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 39, "livery": { "car_id": 41, @@ -907,11 +949,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 34, "club_name": "Australia/NZ", "club_shortname": "Australia/NZ", "division": 2, - "division_name": "Silver Division", + "division_name": "Division 3", "old_license_level": 19, "old_sub_level": 383, "old_cpi": 83.22893, @@ -931,6 +975,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 0, "livery": { "car_id": 41, @@ -995,11 +1040,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 14, "club_name": "New York", "club_shortname": "New York", "division": 3, - "division_name": "Bronze Division", + "division_name": "Division 4", "old_license_level": 16, "old_sub_level": 499, "old_cpi": 117.635025, @@ -1019,6 +1066,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 13, "livery": { "car_id": 41, @@ -1083,11 +1131,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 24, "club_name": "Hispanoamérica", "club_shortname": "Hispanoamérica", "division": 3, - "division_name": "Bronze Division", + "division_name": "Division 4", "old_license_level": 14, "old_sub_level": 227, "old_cpi": 27.574493, @@ -1107,6 +1157,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 59, "livery": { "car_id": 44, @@ -1171,11 +1222,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 24, "club_name": "Hispanoamérica", "club_shortname": "Hispanoamérica", "division": 3, - "division_name": "Bronze Division", + "division_name": "Division 4", "old_license_level": 10, "old_sub_level": 288, "old_cpi": 27.971367, @@ -1195,6 +1248,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 0, "livery": { "car_id": 44, @@ -1259,11 +1313,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 6, "club_name": "California Club", "club_shortname": "California", "division": 4, - "division_name": "Red Division", + "division_name": "Division 5", "old_license_level": 17, "old_sub_level": 164, "old_cpi": 35.060154, @@ -1283,6 +1339,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 50, "livery": { "car_id": 44, @@ -1347,11 +1404,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 38, "club_name": "Iberia", "club_shortname": "Iberia", "division": 6, - "division_name": "Yellow Division", + "division_name": "Division 7", "old_license_level": 11, "old_sub_level": 380, "old_cpi": 38.851532, @@ -1371,6 +1430,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 0, "livery": { "car_id": 44, @@ -1435,11 +1495,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 33, "club_name": "Northwest", "club_shortname": "Northwest", "division": 10, - "division_name": "Rookie Division", + "division_name": "Rookie", "old_license_level": 7, "old_sub_level": 338, "old_cpi": 20.44198, @@ -1459,6 +1521,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 25, "livery": { "car_id": 44, @@ -1523,11 +1586,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 36, "club_name": "UK and I", "club_shortname": "UK and I", "division": 7, - "division_name": "White Division", + "division_name": "Division 8", "old_license_level": 10, "old_sub_level": 258, "old_cpi": 23.074778, @@ -1547,6 +1612,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 16, "livery": { "car_id": 44, @@ -1611,11 +1677,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 26, "club_name": "Illinois", "club_shortname": "Illinois", "division": 6, - "division_name": "Yellow Division", + "division_name": "Division 7", "old_license_level": 6, "old_sub_level": 263, "old_cpi": 16.102045, @@ -1635,6 +1703,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 42, "livery": { "car_id": 44, @@ -1699,11 +1768,13 @@ "starting_position": -1, "starting_position_in_class": -1, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 23, "club_name": "Mid-South", "club_shortname": "Mid-South", "division": 8, - "division_name": "Green Division", + "division_name": "Division 9", "old_license_level": 10, "old_sub_level": 219, "old_cpi": 18.054657, @@ -1723,6 +1794,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 33, "livery": { "car_id": 44, @@ -1796,11 +1868,13 @@ "starting_position": 0, "starting_position_in_class": 0, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 34, "club_name": "Australia/NZ", "club_shortname": "Australia/NZ", "division": 0, - "division_name": "Diamond Division", + "division_name": "Division 1", "old_license_level": 20, "old_sub_level": 458, "old_cpi": 103.9162, @@ -1820,6 +1894,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 132, "livery": { "car_id": 41, @@ -1884,11 +1959,13 @@ "starting_position": 2, "starting_position_in_class": 2, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 45, "club_name": "Brazil", "club_shortname": "Brazil", "division": 1, - "division_name": "Gold Division", + "division_name": "Division 2", "old_license_level": 15, "old_sub_level": 334, "old_cpi": 41.450016, @@ -1908,6 +1985,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 118, "livery": { "car_id": 41, @@ -1972,11 +2050,13 @@ "starting_position": 1, "starting_position_in_class": 1, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 29, "club_name": "Midwest", "club_shortname": "Midwest", "division": 1, - "division_name": "Gold Division", + "division_name": "Division 2", "old_license_level": 14, "old_sub_level": 293, "old_cpi": 42.26631, @@ -1996,6 +2076,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 105, "livery": { "car_id": 41, @@ -2060,11 +2141,13 @@ "starting_position": 5, "starting_position_in_class": 5, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 43, "club_name": "Scandinavia", "club_shortname": "Scandinavia", "division": 3, - "division_name": "Bronze Division", + "division_name": "Division 4", "old_license_level": 15, "old_sub_level": 390, "old_cpi": 60.17846, @@ -2084,6 +2167,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 92, "livery": { "car_id": 41, @@ -2148,11 +2232,13 @@ "starting_position": 4, "starting_position_in_class": 4, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 49, "club_name": "Mexico", "club_shortname": "Mexico", "division": 1, - "division_name": "Gold Division", + "division_name": "Division 2", "old_license_level": 14, "old_sub_level": 249, "old_cpi": 31.632631, @@ -2172,6 +2258,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 79, "livery": { "car_id": 41, @@ -2236,11 +2323,13 @@ "starting_position": 6, "starting_position_in_class": 6, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 30, "club_name": "Texas", "club_shortname": "Texas", "division": 3, - "division_name": "Bronze Division", + "division_name": "Division 4", "old_license_level": 7, "old_sub_level": 343, "old_cpi": 20.96678, @@ -2260,6 +2349,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 66, "livery": { "car_id": 41, @@ -2324,11 +2414,13 @@ "starting_position": 8, "starting_position_in_class": 8, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 15, "club_name": "Canada", "club_shortname": "Canada", "division": 2, - "division_name": "Silver Division", + "division_name": "Division 3", "old_license_level": 16, "old_sub_level": 418, "old_cpi": 54.10679, @@ -2348,6 +2440,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 52, "livery": { "car_id": 41, @@ -2412,11 +2505,13 @@ "starting_position": 12, "starting_position_in_class": 1, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 24, "club_name": "Hispanoamérica", "club_shortname": "Hispanoamérica", "division": 3, - "division_name": "Bronze Division", + "division_name": "Division 4", "old_license_level": 14, "old_sub_level": 227, "old_cpi": 27.574493, @@ -2436,6 +2531,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 59, "livery": { "car_id": 44, @@ -2500,11 +2596,13 @@ "starting_position": 11, "starting_position_in_class": 0, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 6, "club_name": "California Club", "club_shortname": "California", "division": 4, - "division_name": "Red Division", + "division_name": "Division 5", "old_license_level": 17, "old_sub_level": 164, "old_cpi": 35.060154, @@ -2524,6 +2622,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 50, "livery": { "car_id": 44, @@ -2588,11 +2687,13 @@ "starting_position": 17, "starting_position_in_class": 6, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 26, "club_name": "Illinois", "club_shortname": "Illinois", "division": 6, - "division_name": "Yellow Division", + "division_name": "Division 7", "old_license_level": 6, "old_sub_level": 263, "old_cpi": 16.102045, @@ -2612,6 +2713,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 42, "livery": { "car_id": 44, @@ -2676,11 +2778,13 @@ "starting_position": 9, "starting_position_in_class": 9, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 32, "club_name": "West", "club_shortname": "West", "division": 2, - "division_name": "Silver Division", + "division_name": "Division 3", "old_license_level": 20, "old_sub_level": 433, "old_cpi": 88.018936, @@ -2700,6 +2804,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 39, "livery": { "car_id": 41, @@ -2764,11 +2869,13 @@ "starting_position": 7, "starting_position_in_class": 7, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 24, "club_name": "Hispanoamérica", "club_shortname": "Hispanoamérica", "division": 2, - "division_name": "Silver Division", + "division_name": "Division 3", "old_license_level": 15, "old_sub_level": 367, "old_cpi": 51.642273, @@ -2788,6 +2895,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 26, "livery": { "car_id": 41, @@ -2852,11 +2960,13 @@ "starting_position": 18, "starting_position_in_class": 7, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 23, "club_name": "Mid-South", "club_shortname": "Mid-South", "division": 8, - "division_name": "Green Division", + "division_name": "Division 9", "old_license_level": 10, "old_sub_level": 219, "old_cpi": 18.054657, @@ -2876,6 +2986,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 33, "livery": { "car_id": 44, @@ -2940,11 +3051,13 @@ "starting_position": 15, "starting_position_in_class": 4, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 33, "club_name": "Northwest", "club_shortname": "Northwest", "division": 10, - "division_name": "Rookie Division", + "division_name": "Rookie", "old_license_level": 7, "old_sub_level": 338, "old_cpi": 20.44198, @@ -2964,6 +3077,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 25, "livery": { "car_id": 44, @@ -3028,11 +3142,13 @@ "starting_position": 10, "starting_position_in_class": 10, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 14, "club_name": "New York", "club_shortname": "New York", "division": 3, - "division_name": "Bronze Division", + "division_name": "Division 4", "old_license_level": 16, "old_sub_level": 499, "old_cpi": 117.635025, @@ -3052,6 +3168,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 13, "livery": { "car_id": 41, @@ -3116,11 +3233,13 @@ "starting_position": 16, "starting_position_in_class": 5, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 36, "club_name": "UK and I", "club_shortname": "UK and I", "division": 7, - "division_name": "White Division", + "division_name": "Division 8", "old_license_level": 10, "old_sub_level": 258, "old_cpi": 23.074778, @@ -3140,6 +3259,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 16, "livery": { "car_id": 44, @@ -3204,11 +3324,13 @@ "starting_position": 3, "starting_position_in_class": 3, "car_class_id": 45, + "car_class_name": "Cadillac CTS-VR", + "car_class_short_name": "Cadillac CTS-VR", "club_id": 34, "club_name": "Australia/NZ", "club_shortname": "Australia/NZ", "division": 2, - "division_name": "Silver Division", + "division_name": "Division 3", "old_license_level": 19, "old_sub_level": 383, "old_cpi": 83.22893, @@ -3228,6 +3350,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 41, + "car_name": "Cadillac CTS-V Racecar", "aggregate_champ_points": 0, "livery": { "car_id": 41, @@ -3292,11 +3415,13 @@ "starting_position": 14, "starting_position_in_class": 3, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 38, "club_name": "Iberia", "club_shortname": "Iberia", "division": 6, - "division_name": "Yellow Division", + "division_name": "Division 7", "old_license_level": 11, "old_sub_level": 380, "old_cpi": 38.851532, @@ -3316,6 +3441,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 0, "livery": { "car_id": 44, @@ -3380,11 +3506,13 @@ "starting_position": 13, "starting_position_in_class": 2, "car_class_id": 48, + "car_class_name": "Kia Optima", + "car_class_short_name": "Kia Optima", "club_id": 24, "club_name": "Hispanoamérica", "club_shortname": "Hispanoamérica", "division": 3, - "division_name": "Bronze Division", + "division_name": "Division 4", "old_license_level": 10, "old_sub_level": 288, "old_cpi": 27.971367, @@ -3404,6 +3532,7 @@ "league_points": 0, "league_agg_points": 0, "car_id": 44, + "car_name": "Kia Optima", "aggregate_champ_points": 0, "livery": { "car_id": 44, @@ -3461,25 +3590,25 @@ "car_class_id": 45, "cars_in_class": [ { - "car_id": 41, - "package_id": 122 + "car_id": 41 } ], "name": "Cadillac CTS-VR", - "relative_speed": 50, - "short_name": "Cadillac CTS-VR" + "short_name": "Cadillac CTS-VR", + "strength_of_field": 2303, + "num_entries": 11 }, { "car_class_id": 48, "cars_in_class": [ { - "car_id": 44, - "package_id": 136 + "car_id": 44 } ], "name": "Kia Optima", - "relative_speed": 46, - "short_name": "Kia Optima" + "short_name": "Kia Optima", + "strength_of_field": 1029, + "num_entries": 8 } ], "allowed_licenses": [ diff --git a/src/Aydsko.iRacingData/CompatibilitySuppressions.xml b/src/Aydsko.iRacingData/CompatibilitySuppressions.xml index 934f523..1cdda84 100644 --- a/src/Aydsko.iRacingData/CompatibilitySuppressions.xml +++ b/src/Aydsko.iRacingData/CompatibilitySuppressions.xml @@ -119,6 +119,41 @@ lib/net6.0/Aydsko.iRacingData.dll true + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.get_SimulatedStart + lib/net6.0/Aydsko.iRacingData.dll + lib/net6.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.get_SimulatedStartUtcOffset + lib/net6.0/Aydsko.iRacingData.dll + lib/net6.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.get_SimulatedStartUtcTime + lib/net6.0/Aydsko.iRacingData.dll + lib/net6.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.set_SimulatedStartUtcOffset(System.TimeSpan) + lib/net6.0/Aydsko.iRacingData.dll + lib/net6.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.set_SimulatedStartUtcTime(System.DateTimeOffset) + lib/net6.0/Aydsko.iRacingData.dll + lib/net6.0/Aydsko.iRacingData.dll + true + CP0002 M:Aydsko.iRacingData.Series.Weather.get_RelHumidity @@ -308,6 +343,41 @@ lib/net8.0/Aydsko.iRacingData.dll true + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.get_SimulatedStart + lib/net8.0/Aydsko.iRacingData.dll + lib/net8.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.get_SimulatedStartUtcOffset + lib/net8.0/Aydsko.iRacingData.dll + lib/net8.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.get_SimulatedStartUtcTime + lib/net8.0/Aydsko.iRacingData.dll + lib/net8.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.set_SimulatedStartUtcOffset(System.TimeSpan) + lib/net8.0/Aydsko.iRacingData.dll + lib/net8.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.set_SimulatedStartUtcTime(System.DateTimeOffset) + lib/net8.0/Aydsko.iRacingData.dll + lib/net8.0/Aydsko.iRacingData.dll + true + CP0002 M:Aydsko.iRacingData.Series.Weather.get_RelHumidity @@ -563,6 +633,41 @@ lib/netstandard2.0/Aydsko.iRacingData.dll true + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.get_SimulatedStart + lib/netstandard2.0/Aydsko.iRacingData.dll + lib/netstandard2.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.get_SimulatedStartUtcOffset + lib/netstandard2.0/Aydsko.iRacingData.dll + lib/netstandard2.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.get_SimulatedStartUtcTime + lib/netstandard2.0/Aydsko.iRacingData.dll + lib/netstandard2.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.set_SimulatedStartUtcOffset(System.TimeSpan) + lib/netstandard2.0/Aydsko.iRacingData.dll + lib/netstandard2.0/Aydsko.iRacingData.dll + true + + + CP0002 + M:Aydsko.iRacingData.Results.ResultsWeather.set_SimulatedStartUtcTime(System.DateTimeOffset) + lib/netstandard2.0/Aydsko.iRacingData.dll + lib/netstandard2.0/Aydsko.iRacingData.dll + true + CP0002 M:Aydsko.iRacingData.Series.Weather.get_RelHumidity diff --git a/src/Aydsko.iRacingData/Package Release Notes.txt b/src/Aydsko.iRacingData/Package Release Notes.txt index c727583..bcb3778 100644 --- a/src/Aydsko.iRacingData/Package Release Notes.txt +++ b/src/Aydsko.iRacingData/Package Release Notes.txt @@ -4,14 +4,21 @@ - Properly interpret "BestLapTime" as "TimeSpan" similar to other times - "PercentRank" is now a "decimal" type instead of "int" + - "ResultsWeather" type: + - Removed "SimulatedStartUtcTime" and "SimulatedStartUtcOffset" fields + - Changed data type of "SimulatedStartTime" field to "DateTime" + - "Results.CarsInClass" type: + - Removed "PackageId" field -Contributions: + - "Results.ResultsCarClasses" type: + - Removed "RelativeSpeed" field - - From - - + - "Schedule" type: + - Removed "SimulatedTimeMultiplier" field -Thanks for helping out with pull requests to the library! + - "Series.Weather" type: + - Removed "SimulatedStartUtcTime" field @@ -19,3 +26,7 @@ Fixes / Changes: - Incorrect datatype for RecentEvents.PercentRank field (Issue: #210) + - 2024 Season 3 Patch 2 Field Changes (Results & Series Seasons) (Issue: #211) + - "SubSessionResult" type additional fields "NumberOfDrivers", "EventBestLapTime", "SessionSplits" + - "Result" type additional field "CarName" + - "Results.ResultsCarClasses" type new fields "StrengthOfField" and "NumberOfEntries" diff --git a/src/Aydsko.iRacingData/Results/CarsInClass.cs b/src/Aydsko.iRacingData/Results/CarsInClass.cs index b1097f3..2f7792a 100644 --- a/src/Aydsko.iRacingData/Results/CarsInClass.cs +++ b/src/Aydsko.iRacingData/Results/CarsInClass.cs @@ -1,4 +1,4 @@ -// © 2023 Adrian Clark +// © 2023-2024 Adrian Clark // This file is licensed to you under the MIT license. namespace Aydsko.iRacingData.Results; @@ -7,7 +7,4 @@ public class CarsInClass { [JsonPropertyName("car_id")] public int CarId { get; set; } - - [JsonPropertyName("package_id")] - public int PackageId { get; set; } } diff --git a/src/Aydsko.iRacingData/Results/Result.cs b/src/Aydsko.iRacingData/Results/Result.cs index 6489679..e62c3b6 100644 --- a/src/Aydsko.iRacingData/Results/Result.cs +++ b/src/Aydsko.iRacingData/Results/Result.cs @@ -191,6 +191,9 @@ public class Result [JsonPropertyName("car_class_short_name")] public string CarClassShortName { get; set; } = default!; + [JsonPropertyName("car_name")] + public string CarName { get; set; } = default!; + [JsonPropertyName("aggregate_champ_points")] public int AggregateChampionshipPoints { get; set; } diff --git a/src/Aydsko.iRacingData/Results/CarClasses.cs b/src/Aydsko.iRacingData/Results/ResultsCarClasses.cs similarity index 74% rename from src/Aydsko.iRacingData/Results/CarClasses.cs rename to src/Aydsko.iRacingData/Results/ResultsCarClasses.cs index 4b6e244..18be007 100644 --- a/src/Aydsko.iRacingData/Results/CarClasses.cs +++ b/src/Aydsko.iRacingData/Results/ResultsCarClasses.cs @@ -14,9 +14,12 @@ public class ResultsCarClasses [JsonPropertyName("name")] public string Name { get; set; } = default!; - [JsonPropertyName("relative_speed")] - public int RelativeSpeed { get; set; } - [JsonPropertyName("short_name")] public string ShortName { get; set; } = default!; + + [JsonPropertyName("strength_of_field")] + public int StrengthOfField { get; set; } + + [JsonPropertyName("num_entries")] + public int NumberOfEntries { get; set; } } diff --git a/src/Aydsko.iRacingData/Results/ResultsWeather.cs b/src/Aydsko.iRacingData/Results/ResultsWeather.cs index 2906996..e1262f2 100644 --- a/src/Aydsko.iRacingData/Results/ResultsWeather.cs +++ b/src/Aydsko.iRacingData/Results/ResultsWeather.cs @@ -1,40 +1,39 @@ -// © 2023 Adrian Clark +// © 2023-2024 Adrian Clark // This file is licensed to you under the MIT license. -using Aydsko.iRacingData.Converters; - namespace Aydsko.iRacingData.Results; public class ResultsWeather : Weather { - [JsonPropertyName("simulated_start_utc_time")] - public DateTimeOffset SimulatedStartUtcTime { get; set; } - - [JsonPropertyName("simulated_start_utc_offset"), JsonConverter(typeof(UtcOffsetToTimeSpanConverter))] - public TimeSpan SimulatedStartUtcOffset { get; set; } - - [JsonIgnore] - public DateTimeOffset SimulatedStart => new(SimulatedStartUtcTime.DateTime.Add(SimulatedStartUtcOffset), SimulatedStartUtcOffset); + /// The date and time within the simulation that this weather is related to. + [JsonPropertyName("simulated_start_time")] + public DateTime SimulatedStart { get; set; } + /// If fog was allowed. [JsonPropertyName("allow_fog")] public bool AllowFog { get; set; } + /// The level of water on the track. [JsonPropertyName("track_water")] public int TrackWater { get; set; } + /// Percentage of session time it was raining. [JsonPropertyName("precip_time_pct")] public decimal PrecipitationTimePercentage { get; set; } + /// Amount of rain that fell in millimetres. [JsonPropertyName("precip_mm_final_session")] public decimal PrecipitationMillimetresFinalSession { get; set; } + /// The rain option value. [JsonPropertyName("precip_option")] public decimal PrecipitationOption { get; set; } + /// Amount of rain that fell two hours before the final session in millimetres. [JsonPropertyName("precip_mm2hr_before_final_session")] public decimal PrecipitationMillimetres2HoursBeforeFinalSession { get; set; } - + + /// How much the time is accelerated by. [JsonPropertyName("simulated_time_multiplier")] public int SimulatedTimeMultiplier { get; set; } - } diff --git a/src/Aydsko.iRacingData/Results/SessionSplit.cs b/src/Aydsko.iRacingData/Results/SessionSplit.cs new file mode 100644 index 0000000..0ba349c --- /dev/null +++ b/src/Aydsko.iRacingData/Results/SessionSplit.cs @@ -0,0 +1,37 @@ +// © 2024 Adrian Clark +// This file is licensed to you under the MIT license. + +namespace Aydsko.iRacingData.Results; + +public class SessionSplit : IEquatable +{ + [JsonPropertyName("subsession_id")] + public int SubSessionId { get; set; } + + [JsonPropertyName("event_strength_of_field")] + public int EventStrengthOfField { get; set; } + + public bool Equals(SessionSplit? other) + { + if (other is null) + { + return false; + } + + return SubSessionId == other.SubSessionId; + } + + public override bool Equals(object? obj) + { + return Equals(obj as SessionSplit); + } + + public override int GetHashCode() + { +#if NET6_0_OR_GREATER + return HashCode.Combine(SubSessionId); +#else + return SubSessionId; +#endif + } +} diff --git a/src/Aydsko.iRacingData/Results/SubSessionResult.cs b/src/Aydsko.iRacingData/Results/SubSessionResult.cs index 0757d0c..efa3cee 100644 --- a/src/Aydsko.iRacingData/Results/SubSessionResult.cs +++ b/src/Aydsko.iRacingData/Results/SubSessionResult.cs @@ -112,9 +112,15 @@ public class SubSessionResult [JsonPropertyName("event_strength_of_field")] public int EventStrengthOfField { get; set; } + [JsonPropertyName("num_drivers")] + public int NumberOfDrivers { get; set; } + [JsonPropertyName("event_average_lap"), JsonConverter(typeof(TenThousandthSecondDurationNotNullConverter))] public TimeSpan EventAverageLap { get; set; } + [JsonPropertyName("event_best_lap_time"), JsonConverter(typeof(TenThousandthSecondDurationNotNullConverter))] + public TimeSpan EventBestLapTime { get; set; } + [JsonPropertyName("event_laps_complete")] public int EventLapsComplete { get; set; } @@ -192,6 +198,9 @@ public class SubSessionResult [JsonPropertyName("associated_subsession_ids")] public int[] AssociatedSubSessionIds { get; set; } = default!; + + [JsonPropertyName("session_splits")] + public SessionSplit[] SessionSplits { get; set; } = default!; } [JsonSerializable(typeof(SubSessionResult)), JsonSourceGenerationOptions(WriteIndented = true)] diff --git a/src/Aydsko.iRacingData/Series/Schedule.cs b/src/Aydsko.iRacingData/Series/Schedule.cs index 0bf4058..f5562dc 100644 --- a/src/Aydsko.iRacingData/Series/Schedule.cs +++ b/src/Aydsko.iRacingData/Series/Schedule.cs @@ -40,9 +40,6 @@ public class Schedule public DateTime StartDate { get; set; } = default!; #endif - [JsonPropertyName("simulated_time_multiplier")] - public int SimulatedTimeMultiplier { get; set; } - [JsonPropertyName("race_lap_limit")] public int? RaceLapLimit { get; set; } diff --git a/src/Aydsko.iRacingData/Series/Weather.cs b/src/Aydsko.iRacingData/Series/Weather.cs index 779a77e..07df2cd 100644 --- a/src/Aydsko.iRacingData/Series/Weather.cs +++ b/src/Aydsko.iRacingData/Series/Weather.cs @@ -58,12 +58,6 @@ public class Weather [JsonPropertyName("simulated_time_offsets")] public int[] SimulatedTimeOffsets { get; set; } = Array.Empty(); - [JsonPropertyName("simulated_time_multiplier")] - public int SimulatedTimeMultiplier { get; set; } - - [JsonPropertyName("simulated_start_utc_time")] - public DateTimeOffset SimulatedStartUtcTime { get; set; } - [JsonPropertyName("precip_option")] public int PrecipitationOption { get; set; }