Skip to content

Commit 3279c03

Browse files
committed
Update error handling and initialization methods
- Add `using System;` to `CountryCodeHelper.cs` - Throw `ArgumentException` for invalid country codes - Initialize `Series` property with an empty array in `PlayoffSeriesSchedule.cs`
1 parent aec207d commit 3279c03

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Nhl.Api.Common/Helpers/CountryCodeHelper.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Nhl.Api.Common.Helpers;
1+
using System;
2+
3+
namespace Nhl.Api.Common.Helpers;
24

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

1250-
return string.Empty;
1252+
throw new ArgumentException($"Country code {countryCode} not found");
12511253
}
12521254
}

Nhl.Api.Domain/Models/Schedule/PlayoffSeriesSchedule.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public class Round
117117
/// Example: new List&lt;Series&gt; { /* Series objects */ }
118118
/// </summary>
119119
[JsonProperty("series")]
120-
public List<Series> Series { get; set; } = new List<Series>();
120+
public List<Series> Series { get; set; } = [];
121121
}
122122

123123
/// <summary>

Nhl.Api.Tests/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[assembly: Parallelize(Workers = 4, Scope = ExecutionScope.MethodLevel)]
1+
[assembly: Parallelize(Workers = 4, Scope = ExecutionScope.MethodLevel)]
22
namespace Nhl.Api.Tests;
33

4-
internal class AssemblyInfo
4+
internal sealed class AssemblyInfo
55
{
66
}

0 commit comments

Comments
 (0)