Skip to content

Commit

Permalink
Update error handling and initialization methods
Browse files Browse the repository at this point in the history
- Add `using System;` to `CountryCodeHelper.cs`
- Throw `ArgumentException` for invalid country codes
- Initialize `Series` property with an empty array in `PlayoffSeriesSchedule.cs`
  • Loading branch information
Afischbacher committed Mar 8, 2025
1 parent aec207d commit 3279c03
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Nhl.Api.Common/Helpers/CountryCodeHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Nhl.Api.Common.Helpers;
using System;

namespace Nhl.Api.Common.Helpers;

/// <summary>
/// A helper class for converting ISO standard country codes to the full country name
Expand Down Expand Up @@ -1247,6 +1249,6 @@ public static string ConvertThreeDigitCountryCodeToFullCountryName(string countr
return "Zimbabwe";
}

return string.Empty;
throw new ArgumentException($"Country code {countryCode} not found");
}
}
2 changes: 1 addition & 1 deletion Nhl.Api.Domain/Models/Schedule/PlayoffSeriesSchedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public class Round
/// Example: new List&lt;Series&gt; { /* Series objects */ }
/// </summary>
[JsonProperty("series")]
public List<Series> Series { get; set; } = new List<Series>();
public List<Series> Series { get; set; } = [];
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Nhl.Api.Tests/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[assembly: Parallelize(Workers = 4, Scope = ExecutionScope.MethodLevel)]
[assembly: Parallelize(Workers = 4, Scope = ExecutionScope.MethodLevel)]
namespace Nhl.Api.Tests;

internal class AssemblyInfo
internal sealed class AssemblyInfo
{
}

0 comments on commit 3279c03

Please sign in to comment.