(), FakeTimeProvider);
24 | }
25 |
26 | protected override void Dispose(bool disposing)
27 | {
28 | if (disposing)
29 | {
30 | _legacyApiClient?.Dispose();
31 | _apiClientBase?.Dispose();
32 | }
33 | base.Dispose(disposing);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Aydsko.iRacingData/Lookups/LicenseLevel.cs:
--------------------------------------------------------------------------------
1 | // © 2023 Adrian Clark
2 | // This file is licensed to you under the MIT license.
3 |
4 | namespace Aydsko.iRacingData.Lookups;
5 |
6 | /// Sub-level within a license.
7 | public class LicenseLevel
8 | {
9 | /// Unique identifier for this license level.
10 | [JsonPropertyName("license_id")]
11 | public int LicenseId { get; set; }
12 |
13 | /// Unique identifier for the license category.
14 | [JsonPropertyName("license_group")]
15 | public int LicenseGroup { get; set; }
16 |
17 | /// Display name for the license level.
18 | [JsonPropertyName("license")]
19 | public string License { get; set; } = default!;
20 |
21 | /// Short display name for the license level.
22 | [JsonPropertyName("short_name")]
23 | public string ShortName { get; set; } = default!;
24 |
25 | /// Letter code for the license level.
26 | [JsonPropertyName("license_letter")]
27 | public string LicenseLetter { get; set; } = default!;
28 |
29 | /// Color code for the license level.
30 | /// This is an HTML color code.
31 | [JsonPropertyName("color")]
32 | public string Color { get; set; } = default!;
33 | }
34 |
--------------------------------------------------------------------------------
/src/Aydsko.iRacingData.UnitTests/Responses/GetSeasonQualifyResultsSuccessfulAsync/2.json:
--------------------------------------------------------------------------------
1 | {
2 | "headers": {},
3 | "content": {
4 | "success": true,
5 | "season_id": 3587,
6 | "season_name": "NASCAR iRacing Class C Series - 2022 Season",
7 | "season_short_name": "2022 Season",
8 | "series_id": 47,
9 | "series_name": "NASCAR iRacing Class C",
10 | "car_class_id": 71,
11 | "race_week_num": 0,
12 | "chunk_info": {
13 | "chunk_size": 500,
14 | "num_chunks": 7,
15 | "rows": 3078,
16 | "base_download_url": "https://dqfp1ltauszrc.cloudfront.net/public/standings/season/3587/season-driver/71/0/",
17 | "chunk_file_names": [
18 | "6b80dc340e9a5fc4f04988e0c98987ca3e794eb80eefe21bad06412b3b699f12.json",
19 | "68c5708be074ea5d9d02d2a16bbec12517c0fd073ea07c345e9d3bb72e26e29d.json",
20 | "21257b98997854a754d12e96d2b2ca1ce80868a67359f322e26850d4b02cba6c.json",
21 | "5507f211f81533a777b9f1eb61a621073073dd16030431fe88b751e68c9bd26f.json",
22 | "9ab0db04bb3a9b45b48ffebd530965dc9b9ca1063746309d4927e89f4ba34ec6.json",
23 | "c68f16fb3631dc881bab19b5b975efceb469269b9e54abda2b0927059453ba3f.json",
24 | "70feebbb5b5ff234210355c3a96a502c5e0eed08504ab21c61291b470b2a27c4.json"
25 | ]
26 | },
27 | "last_updated": "2022-04-13T13:58:08.794339Z"
28 | }
29 | }
--------------------------------------------------------------------------------
/src/Aydsko.iRacingData.IntegrationTests/Lookups/CachingLookupTests.cs:
--------------------------------------------------------------------------------
1 | // © Adrian Clark - Aydsko.iRacingData
2 | // This file is licensed to you under the MIT license.
3 |
4 | namespace Aydsko.iRacingData.IntegrationTests.Lookups;
5 |
6 | internal sealed class CachingLookupTests : CachingIntegrationFixture
7 | {
8 | [Test(TestOf = typeof(DataClient))]
9 | public async Task TestLicenseLookupsAreCachedAsync()
10 | {
11 | var license = await Client.GetLicenseLookupsAsync(CancellationToken.None).ConfigureAwait(false);
12 |
13 | Assert.That(license, Is.Not.Null);
14 | Assert.That(license.Data, Is.Not.Null);
15 |
16 | Assert.That(license.Data, Has.Length.EqualTo(7));
17 |
18 | var license2 = await Client.GetLicenseLookupsAsync(CancellationToken.None).ConfigureAwait(false);
19 |
20 | Assert.That(license2, Is.Not.Null);
21 | Assert.That(license2.Data, Is.Not.Null);
22 |
23 | Assert.That(license2.Data, Has.Length.EqualTo(7));
24 |
25 | var stats = MemoryCache.GetCurrentStatistics();
26 |
27 | using (Assert.EnterMultipleScope())
28 | {
29 | Assert.That(stats?.TotalHits, Is.Not.Null.And.EqualTo(1), "TotalHits didn't match.");
30 | Assert.That(stats?.TotalMisses, Is.Not.Null.And.EqualTo(1), "TotalMisses didn't match.");
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Aydsko.iRacingData.IntegrationTests/Results/CachingResultsGetTest.cs:
--------------------------------------------------------------------------------
1 | // © Adrian Clark - Aydsko.iRacingData
2 | // This file is licensed to you under the MIT license.
3 |
4 | namespace Aydsko.iRacingData.IntegrationTests.Results;
5 |
6 | internal sealed class CachingResultsGetTest : CachingIntegrationFixture
7 | {
8 | [Test]
9 | public async Task GivenAValidSubsessionIdThenAResultIsReturnedAsync()
10 | {
11 | var results = await Client.GetSubSessionResultAsync(50033865, true).ConfigureAwait(false);
12 | using (Assert.EnterMultipleScope())
13 | {
14 | Assert.That(results, Is.Not.Null);
15 | Assert.That(results.Data, Is.Not.Null);
16 | }
17 |
18 | var results2 = await Client.GetSubSessionResultAsync(50033865, true).ConfigureAwait(false);
19 | using (Assert.EnterMultipleScope())
20 | {
21 | Assert.That(results2, Is.Not.Null);
22 | Assert.That(results2.Data, Is.Not.Null);
23 | }
24 |
25 | var stats = MemoryCache.GetCurrentStatistics();
26 | using (Assert.EnterMultipleScope())
27 | {
28 | Assert.That(stats?.TotalHits, Is.Not.Null.And.EqualTo(1), "TotalHits didn't match.");
29 | Assert.That(stats?.TotalMisses, Is.Not.Null.And.EqualTo(1), "TotalMisses didn't match.");
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Aydsko.iRacingData/TimeAttack/TimeAttackTrack.cs:
--------------------------------------------------------------------------------
1 | // © 2023 Adrian Clark
2 | // This file is licensed to you under the MIT license.
3 |
4 | using Aydsko.iRacingData.Constants;
5 |
6 | namespace Aydsko.iRacingData.TimeAttack;
7 |
8 | public class TimeAttackTrack
9 | {
10 | [JsonPropertyName("trackid")]
11 | public int Trackid { get; set; }
12 |
13 | [JsonPropertyName("w_time_of_day")]
14 | public int WTimeOfDay { get; set; }
15 |
16 | [JsonPropertyName("w_type")]
17 | public int WType { get; set; }
18 |
19 | [JsonPropertyName("w_temp")]
20 | public int WTemp { get; set; }
21 |
22 | [JsonPropertyName("w_humidity")]
23 | public int WHumidity { get; set; }
24 |
25 | [JsonPropertyName("w_wind_dir")]
26 | public int WWindDir { get; set; }
27 |
28 | [JsonIgnore]
29 | public WindDirection WeatherWindDirection => (WindDirection)WWindDir;
30 |
31 | [JsonPropertyName("w_wind_speed")]
32 | public int WWindSpeed { get; set; }
33 |
34 | [JsonPropertyName("w_skies")]
35 | public int WSkies { get; set; }
36 |
37 | [JsonPropertyName("w_fog_level")]
38 | public int WFogLevel { get; set; }
39 |
40 | [JsonPropertyName("w_wind_speed_units")]
41 | public int WWindSpeedUnits { get; set; }
42 |
43 | [JsonPropertyName("w_temp_units")]
44 | public int WTempUnits { get; set; }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Aydsko.iRacingData.UnitTests/Responses/GetWorldRecordStatisticsSuccessfulAsync/2.json:
--------------------------------------------------------------------------------
1 | {
2 | "headers": {},
3 | "content": {
4 | "type": "stats_world_records",
5 | "data": {
6 | "success": true,
7 | "car_id": 145,
8 | "track_id": 341,
9 | "chunk_info": {
10 | "chunk_size": 2000,
11 | "num_chunks": 2,
12 | "rows": 10614,
13 | "base_download_url": "https://scorpio-assets.s3.amazonaws.com/members/messaging-services/short_lived/worldrecords/carid_145/trackid_341/year_all/quarter_all/",
14 | "chunk_file_names": [
15 | "f6d4f9779b1965c2afff028f08eeca26bfb69857d3aa53cd2661382f2ad0c8ba.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220924T120128Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=AKIAUO6OO4A3357USLO7%2F20220924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=f363ed5042b9108bfbc535fae3b57786dbb4077e208a20063643395185fd988c",
16 | "f7dadcb04caf0e264d1aa984ef889019b38ca1319102d691c35e5b4630d25e2b.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220924T120128Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=AKIAUO6OO4A3357USLO7%2F20220924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=3c30130011f5ef205eb081618b77017913b77871d7e490df8aa88db8412d6aad"
17 | ]
18 | },
19 | "last_updated": "2022-09-24T12:01:28Z"
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/src/Aydsko.iRacingData.UnitTests/Responses/ResponseUnknown504/1.json:
--------------------------------------------------------------------------------
1 | {
2 | "statuscode": 504,
3 | "headers": {
4 | "x-ratelimit-remaining": "238",
5 | "x-ratelimit-limit": "240",
6 | "x-ratelimit-reset": "1657533187"
7 | },
8 | "contentType": "text/html",
9 | "content": "\r\n\r\nERROR: The request could not be satisfied\r\n< BODY>\r\n504 ERROR
\r\nThe request could not be satisfied.
\r\n
\r\nCloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection.\r\nWe can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.\r\n
\r\nIf you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.\r\n
\r\n
\r\n\r\nGenerated by cloudfront (CloudFront)\r\nRequest ID: eSHdZe3nj2sm7o-Jg8cdkzntk-xMUR8lISRFnLBAI12OTMPaM4cnTg==\r\n
\r\n\r\n\r\n