Skip to content

Commit

Permalink
Includes "CountryCode" Property
Browse files Browse the repository at this point in the history
Adds the "CountryCode" property to both the "Result" and "DriverResult"
types to expose the driver's two-letter country code.

Fixes: #288
  • Loading branch information
AdrianJSClark committed Oct 10, 2024
1 parent c761f73 commit ebfb646
Show file tree
Hide file tree
Showing 8 changed files with 22,191 additions and 20,635 deletions.
29 changes: 19 additions & 10 deletions src/Aydsko.iRacingData.UnitTests/CapturedResponseValidationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ public async Task GetSubSessionResultSuccessfulAsync()
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(sampleDriver.CountryCode, Is.EqualTo("AU"));

Assert.That(subSessionResult.Weather, Is.Not.Null);

Expand All @@ -836,10 +837,10 @@ public async Task GetSubSessionResultSuccessfulAsync()
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)));
Assert.That(subSessionResultResponse.RateLimitRemaining, Is.EqualTo(239));
Assert.That(subSessionResultResponse.TotalRateLimit, Is.EqualTo(240));
Assert.That(subSessionResultResponse.RateLimitReset, Is.EqualTo(new DateTimeOffset(2024, 10, 10, 13, 50, 14, TimeSpan.Zero)));
Assert.That(subSessionResultResponse.DataExpires, Is.EqualTo(new DateTimeOffset(2024, 10, 10, 14, 4, 15, 56, TimeSpan.Zero)));
});
}

Expand Down Expand Up @@ -892,13 +893,21 @@ public async Task GetSubSessionResultForTeamSuccessfulAsync()

var racingSociety = raceResults.Results.SingleOrDefault(r => r.TeamId == -261181);
Assert.That(racingSociety?.DriverResults, Has.Length.EqualTo(2));
Assert.That(racingSociety?.DriverResults, Has.One.Property(nameof(DriverResult.CustomerId)).EqualTo(696075));
Assert.That(racingSociety?.DriverResults, Has.One.Property(nameof(DriverResult.CustomerId)).EqualTo(669671));

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)));
var sampleDriverResult = racingSociety?.DriverResults?.FirstOrDefault(d => d.CustomerId == 696075);
Assert.That(sampleDriverResult, Is.Not.Null);
Assert.That(sampleDriverResult!.DisplayName, Is.EqualTo("Fabian Albrecht"));
Assert.That(sampleDriverResult!.CountryCode, Is.EqualTo("DE"));

var sampleDriverResult2 = racingSociety?.DriverResults?.FirstOrDefault(d => d.CustomerId == 669671);
Assert.That(sampleDriverResult2, Is.Not.Null);
Assert.That(sampleDriverResult2!.DisplayName, Is.EqualTo("Mike Honda"));
Assert.That(sampleDriverResult2!.CountryCode, Is.EqualTo("DE"));

Assert.That(subSessionResultResponse.RateLimitRemaining, Is.EqualTo(239));
Assert.That(subSessionResultResponse.TotalRateLimit, Is.EqualTo(240));
Assert.That(subSessionResultResponse.RateLimitReset, Is.EqualTo(new DateTimeOffset(2024, 10, 10, 12, 26, 11, TimeSpan.Zero)));
Assert.That(subSessionResultResponse.DataExpires, Is.EqualTo(new DateTimeOffset(2024, 10, 10, 12, 40, 12, 320, TimeSpan.Zero)));
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
{
"headers": {
"x-ratelimit-remaining": "99",
"x-ratelimit-limit": "100",
"x-ratelimit-reset": "1644451200"
"Connection": "keep-alive",
"Date": "Thu, 10 Oct 2024 12:25:12 GMT",
"ETag": "W/\u0022205-jy7CvOFJf9A8/h1QmzTtglzn4TM\u0022",
"X-iRacing-Env": "members",
"X-iRacing-Id": "e8c08550-e88b-478d-930b-f5abc864ede2",
"X-iRacing-ServiceName": "data-server",
"X-iRacing-ServiceVersion": "2.0.2",
"Content-Security-Policy": "default-src \u0027self\u0027;base-uri \u0027self\u0027;font-src \u0027self\u0027 https: data:;form-action \u0027self\u0027;frame-ancestors \u0027self\u0027;img-src \u0027self\u0027 data:;object-src \u0027none\u0027;script-src \u0027self\u0027;script-src-attr \u0027none\u0027;style-src \u0027self\u0027 https: \u0027unsafe-inline\u0027;upgrade-insecure-requests",
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Resource-Policy": "same-origin",
"Origin-Agent-Cluster": "?1",
"Referrer-Policy": "no-referrer",
"Strict-Transport-Security": "max-age=15552000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"X-DNS-Prefetch-Control": "off",
"X-Download-Options": "noopen",
"X-Frame-Options": "SAMEORIGIN",
"X-Permitted-Cross-Domain-Policies": "none",
"X-XSS-Protection": "0",
"X-RateLimit-Limit": "240",
"X-RateLimit-Remaining": "239",
"X-RateLimit-Reset": "1728563171",
"Cache-Control": "max-age=60",
"X-Cache": "Miss from cloudfront",
"Via": "1.1 1f3b8145d9d0ae60f22075890638c486.cloudfront.net (CloudFront)",
"X-Amz-Cf-Pop": "BNE50-P2",
"X-Amz-Cf-Id": "aVBWcAXFiXf1qFLRR5U0xUiNDqkmgHgdeyq6IhCOOLgkIhVX6ajqsQ=="
},
"content": {
"link": "https://scorpio-assets.s3.amazonaws.com/production/data-server/cache/data-services/stats/member_division/0018ddd2-a9e3-4755-bf38-85b2426851fb?AWSAccessKeyId=AKIAUO6OO4A3357USLO7&Expires=1642767749&Signature=M4K60q92NbjCdV3zqe9I5fAcObw%3D",
"expires": "2022-08-27T11:23:19.507Z"
"link": "https://scorpio-assets.s3.us-east-1.amazonaws.com/production/data-server/cache/data-services/results/get/07fac52e-81ca-4bf2-adeb-0c49e9362728?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAUO6OO4A3357USLO7%2F20241010%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241010T122512Z&X-Amz-Expires=120&X-Amz-Signature=9a477a18a2e236f8a5f69c6f6389d9f20a10574704755b5b04449ed314256ed0&X-Amz-SignedHeaders=host&x-id=GetObject",
"expires": "2024-10-10T12:40:12.320Z"
}
}
Loading

0 comments on commit ebfb646

Please sign in to comment.