Skip to content

Commit

Permalink
Formatting / Warnings Clean Up
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianJSClark committed Nov 2, 2024
1 parent 1a580f0 commit 04b6666
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public async Task GivenValidSearchParametersTheCorrectResultIsReturnedAsync()
{
StartRangeBegin = new DateTime(2022, 6, 1, 0, 0, 0),
StartRangeEnd = new DateTime(2022, 6, 30, 23, 59, 59, 999),
EventTypes = new[] { 5 },
EventTypes = [5],
OfficialOnly = true,
ParticipantCustomerId = 341554
};
Expand Down Expand Up @@ -52,10 +52,10 @@ public async Task GivenSearchParametersThatResultInZeroResultsTheCorrectResultIs
{
StartRangeBegin = new DateTime(2022, 6, 1, 0, 0, 0),
StartRangeEnd = new DateTime(2022, 6, 30, 23, 59, 59, 999),
EventTypes = new[] { 5 },
EventTypes = [5],
OfficialOnly = true,
ParticipantCustomerId = 341554,
CategoryIds = new[] { 1 }
CategoryIds = [1]
};

var searchResults = await Client.SearchOfficialResultsAsync(searchParameters).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public async Task GivenValidSearchParametersTheCorrectResultIsReturnedAsync()
{
StartRangeBegin = new DateTime(2022, 6, 1, 0, 0, 0),
StartRangeEnd = new DateTime(2022, 6, 30, 23, 59, 59, 999),
EventTypes = new[] { 5 },
EventTypes = [5],
OfficialOnly = true,
ParticipantCustomerId = 341554
};
Expand All @@ -35,10 +35,10 @@ public async Task GivenSearchParametersThatResultInZeroResultsTheCorrectResultIs
{
StartRangeBegin = new DateTime(2022, 6, 1, 0, 0, 0),
StartRangeEnd = new DateTime(2022, 6, 30, 23, 59, 59, 999),
EventTypes = new[] { 5 },
EventTypes = [5],
OfficialOnly = true,
ParticipantCustomerId = 341554,
CategoryIds = new[] { 1 }
CategoryIds = [1]
};

var searchResults = await Client.SearchOfficialResultsAsync(searchParameters).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Aydsko.iRacingData.IntegrationTests.Tracks;

internal sealed class GetTracksTests : DataClientIntegrationFixture
{
private Track[] tracksData;
private Track[] tracksData = default!;

[OneTimeSetUp]
public async Task GetTrackDataAsync()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,7 @@ public async Task GetWeatherForecastAsync()
{
await MessageHandler.QueueResponsesAsync(nameof(GetWeatherForecastAsync), false).ConfigureAwait(false);

var response = await sut.GetWeatherForecastFromUrlAsync("http://iracing.com").ConfigureAwait(false);
var response = await sut.GetWeatherForecastFromUrlAsync(new Uri("http://example.com")).ConfigureAwait(false);

Assert.Multiple(() =>
{
Expand Down
2 changes: 1 addition & 1 deletion src/Aydsko.iRacingData/Aydsko.iRacingData.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<!-- Package Validation (https://docs.microsoft.com/en-us/dotnet/fundamentals/package-validation/overview) -->
<EnablePackageValidation>true</EnablePackageValidation>
<PackageValidationBaselineVersion>2403.2.0</PackageValidationBaselineVersion>
<PackageValidationBaselineVersion>2404.4.0</PackageValidationBaselineVersion>
<GenerateCompatibilitySuppressionFile>true</GenerateCompatibilitySuppressionFile>
<EnableStrictModeForCompatibleFrameworksInPackage>true</EnableStrictModeForCompatibleFrameworksInPackage>
<EnableStrictModeForCompatibleTfms>true</EnableStrictModeForCompatibleTfms>
Expand Down
197 changes: 4 additions & 193 deletions src/Aydsko.iRacingData/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -1,145 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Aydsko.iRacingData.Leagues.LeagePointsSystems</Target>
<Left>lib/net6.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Aydsko.iRacingData.Leagues.LeagePointsSystems</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Aydsko.iRacingData.Converters.DateOnlyConverter</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Aydsko.iRacingData.Leagues.LeagePointsSystems</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.DataClient.GetLeaguePointsSystemsAsync(System.Int32,System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Left>lib/net6.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Exceptions.iRacingLoginFailedException.Create(System.String,System.Nullable{System.Boolean})</Target>
<Left>lib/net6.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Hosted.Car.get_PowerAdjustPercent</Target>
<Left>lib/net6.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.IDataClient.GetLeaguePointsSystemsAsync(System.Int32,System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Left>lib/net6.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Series.WeatherSummary.get_PrecipitationChance</Target>
<Left>lib/net6.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Stats.SeasonDriverStanding.get_AverageFieldSize</Target>
<Left>lib/net6.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Stats.SeasonDriverStanding.get_AverageFinishPosition</Target>
<Left>lib/net6.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Stats.SeasonDriverStanding.get_AverageStartPosition</Target>
<Left>lib/net6.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.DataClient.GetLeaguePointsSystemsAsync(System.Int32,System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Exceptions.iRacingLoginFailedException.Create(System.String,System.Nullable{System.Boolean})</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Hosted.Car.get_PowerAdjustPercent</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.IDataClient.GetLeaguePointsSystemsAsync(System.Int32,System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Series.WeatherSummary.get_PrecipitationChance</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Stats.SeasonDriverStanding.get_AverageFieldSize</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Stats.SeasonDriverStanding.get_AverageFinishPosition</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Stats.SeasonDriverStanding.get_AverageStartPosition</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Member.MemberChartDataPoint.get_Day</Target>
Expand Down Expand Up @@ -206,86 +73,30 @@
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net6.0/Aydsko.iRacingData.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.DataClient.GetLeaguePointsSystemsAsync(System.Int32,System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Exceptions.iRacingLoginFailedException.Create(System.String,System.Nullable{System.Boolean})</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Hosted.Car.get_PowerAdjustPercent</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.IDataClient.GetLeaguePointsSystemsAsync(System.Int32,System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Series.WeatherSummary.get_PrecipitationChance</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Stats.SeasonDriverStanding.get_AverageFieldSize</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Stats.SeasonDriverStanding.get_AverageFinishPosition</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Aydsko.iRacingData.Stats.SeasonDriverStanding.get_AverageStartPosition</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:Aydsko.iRacingData.IDataClient.GetLeaguePointsSystemsAsync(System.Int32,System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Target>M:Aydsko.iRacingData.IDataClient.GetSeasonSuperSessionStandingsAsync(System.Int32,System.Int32,System.Nullable{System.Int32},System.Nullable{System.Int32},System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:Aydsko.iRacingData.IDataClient.GetSeasonSuperSessionStandingsAsync(System.Int32,System.Int32,System.Nullable{System.Int32},System.Nullable{System.Int32},System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Target>M:Aydsko.iRacingData.IDataClient.GetWeatherForecastFromUrlAsync(System.Uri,System.Threading.CancellationToken)</Target>
<Left>lib/net8.0/Aydsko.iRacingData.dll</Left>
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:Aydsko.iRacingData.IDataClient.GetLeaguePointsSystemsAsync(System.Int32,System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Target>M:Aydsko.iRacingData.IDataClient.GetSeasonSuperSessionStandingsAsync(System.Int32,System.Int32,System.Nullable{System.Int32},System.Nullable{System.Int32},System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:Aydsko.iRacingData.IDataClient.GetSeasonSuperSessionStandingsAsync(System.Int32,System.Int32,System.Nullable{System.Int32},System.Nullable{System.Int32},System.Nullable{System.Int32},System.Threading.CancellationToken)</Target>
<Target>M:Aydsko.iRacingData.IDataClient.GetWeatherForecastFromUrlAsync(System.Uri,System.Threading.CancellationToken)</Target>
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
Expand Down
12 changes: 11 additions & 1 deletion src/Aydsko.iRacingData/DataClient.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// © 2023-2024 Adrian Clark
// This file is licensed to you under the MIT license.

using System;
using System.Globalization;
using System.Net;
using System.Net.Http.Headers;
Expand Down Expand Up @@ -1594,7 +1593,9 @@ public async Task<DataResponse<RaceGuideResults>> GetRaceGuideAsync(DateTimeOffs

if (includeEndAfterFrom is not null)
{
#pragma warning disable CA1308 // Normalize strings to uppercase - iRacing API requires lowercase
queryParameters.Add("include_end_after_from", includeEndAfterFrom.Value.ToString().ToLowerInvariant());
#pragma warning restore CA1308 // Normalize strings to uppercase
}

var raceGuideUrl = "https://members-ng.iracing.com/data/season/race_guide".ToUrlWithQuery(queryParameters);
Expand Down Expand Up @@ -1935,7 +1936,9 @@ private async Task LoginInternalAsync(CancellationToken cancellationToken)
}
else
{
#pragma warning disable CA1308 // Normalize strings to uppercase - iRacing API requires lowercase
var passwordAndEmail = options.Password + (options.Username?.ToLowerInvariant());
#pragma warning restore CA1308 // Normalize strings to uppercase

#if NET6_0_OR_GREATER
var hashedPasswordAndEmailBytes = SHA256.HashData(Encoding.UTF8.GetBytes(passwordAndEmail));
Expand Down Expand Up @@ -2348,6 +2351,7 @@ public async Task<IEnumerable<Uri>> GetTrackAssetScreenshotUrisAsync(int trackId
: GetTrackAssetScreenshotUris(track, trackAssets);
}

/// <inheritdoc />
public async Task<IEnumerable<WeatherForecast>> GetWeatherForecastFromUrlAsync(string url, CancellationToken cancellationToken = default)
{
#if NET8_0_OR_GREATER
Expand All @@ -2359,6 +2363,12 @@ public async Task<IEnumerable<WeatherForecast>> GetWeatherForecastFromUrlAsync(s
}
#endif

return await GetWeatherForecastFromUrlAsync(new Uri(url), cancellationToken).ConfigureAwait(false);
}

/// <inheritdoc />
public async Task<IEnumerable<WeatherForecast>> GetWeatherForecastFromUrlAsync(Uri url, CancellationToken cancellationToken = default)
{
var data = await httpClient.GetFromJsonAsync(url, WeatherForecastArrayContext.Default.ListWeatherForecast, cancellationToken: cancellationToken)
.ConfigureAwait(false)
?? throw new iRacingDataClientException("Data not found.");
Expand Down
6 changes: 6 additions & 0 deletions src/Aydsko.iRacingData/IDataClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,12 @@ public interface IDataClient
/// <returns>A collection of <see cref="WeatherForecast"/> objects detailing the forecasted weather.</returns>
Task<IEnumerable<WeatherForecast>> GetWeatherForecastFromUrlAsync(string url, CancellationToken cancellationToken = default);

/// <summary>Retrieves the weather forecast for the given track and session time.</summary>
/// <param name="url">Url received from the <see cref="Series.Weather.WeatherUrl"/> property of the season's <see cref="Schedule"/>.</param>
/// <param name="cancellationToken">A token to allow the operation to be cancelled.</param>
/// <returns>A collection of <see cref="WeatherForecast"/> objects detailing the forecasted weather.</returns>
Task<IEnumerable<WeatherForecast>> GetWeatherForecastFromUrlAsync(Uri url, CancellationToken cancellationToken = default);

/// <summary>Retrieve a comma separated value (CSV) file containing driver statistics for the given category.</summary>
/// <param name="categoryId">A valid category identifier.</param>
/// <param name="cancellationToken">A token to allow the operation to be cancelled.</param>
Expand Down

0 comments on commit 04b6666

Please sign in to comment.