Skip to content

Commit

Permalink
Merge pull request #40 from Afischbacher/develop
Browse files Browse the repository at this point in the history
Develop to Master
  • Loading branch information
Afischbacher authored Oct 9, 2023
2 parents 1758a9d + d97a0b7 commit 9aeb46b
Show file tree
Hide file tree
Showing 35 changed files with 727 additions and 542 deletions.
2 changes: 1 addition & 1 deletion Nhl.Api.Common/Http/NhlStaticAssetsApiHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class NhlStaticAssetsApiHttpClient : NhlApiHttpClient
/// <summary>
/// The dedicated NHL static assets NHL HTTP API endpoint
/// </summary>
public const string ClientApiUrl = "https://www-league.nhlstatic.com";
public const string ClientApiUrl = "https://assets.nhle.com";

/// <summary>
/// The dedicated NHL static assets HTTP Client for the Nhl.Api
Expand Down
2 changes: 1 addition & 1 deletion Nhl.Api.Common/Http/NhlSuggestionApiHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class NhlSuggestionApiHttpClient : NhlApiHttpClient
/// <summary>
/// The NHL HTTP API endpoint for the NHL suggestion API
/// </summary>
public const string ClientApiUrl = "https://suggest.svc.nhl.com/svc/suggest/";
public const string ClientApiUrl = "https://search.d3.nhle.com/api/";

/// <summary>
/// The dedicated NHL HTTP Client for the NHL suggestion API
Expand Down
2 changes: 1 addition & 1 deletion Nhl.Api.Common/Nhl.Api.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>2.2.0</Version>
<Version>2.2.1</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Expand Down
5 changes: 3 additions & 2 deletions Nhl.Api.Domain/Models/Player/PlayerSearchResponse.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace Nhl.Api.Models.Player
{
/// <summary>
/// NHL Player Search Response
/// </summary>
[Obsolete("This class is obsolete use the PlayerSearchResult class instead")]
public class PlayerSearchResponse
{
/// <summary>
/// A collection of suggestions for NHL player search
/// </summary>
[JsonProperty("suggestions")]
[Obsolete("This property is obsolete use the PlayerSearchResult class instead")]
public List<string> Suggestions { get; set; }
}
}
77 changes: 67 additions & 10 deletions Nhl.Api.Domain/Models/Player/PlayerSearchResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@ public class PlayerSearchResult
[JsonProperty("playerId")]
public int PlayerId { get; set; }

/// <summary>
/// The full name of the NHL player <br/>
/// Example: Connor Bedard
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }

/// <summary>
/// First name of NHL player <br/>
/// Example: Wayne
/// </summary>
[JsonProperty("firstName")]
public string FirstName { get; set; }
public string FirstName => Name?.Split(' ')[0];

/// <summary>
/// Last name of NHL player <br/>
/// Example: Gretzky
/// </summary>
[JsonProperty("lastName")]
public string LastName { get; set; }
public string LastName => Name?.Split(' ')[1];

/// <summary>
/// Height of the NHL player in feet and inches <br/>
Expand All @@ -38,13 +43,28 @@ public class PlayerSearchResult
[JsonProperty("height")]
public string Height { get; set; }

/// <summary>
/// Height of the NHL player in centimeters <br/>
/// Example: 183
/// </summary>
[JsonProperty("heightInCentimeters")]
public string HeightInCentimeters { get; set; }

/// <summary>
/// Weight of the NHL player in pounds <br/>
/// Example: 185
/// </summary>
[JsonProperty("weight")]
[JsonProperty("weightInPounds")]
public string Weight { get; set; }

/// <summary>
/// Weight of the NHL player in kilograms <br/>
/// Example: 185
/// </summary>
[JsonProperty("weightInKilograms")]
public string WeightInKilograms { get; set; }


/// <summary>
/// City of birth for the NHL player <br/>
/// Example: Brantford
Expand All @@ -56,7 +76,7 @@ public class PlayerSearchResult
/// Province or state of birth for the NHL player <br/>
/// Example: ON
/// </summary>
[JsonProperty("birthProvinceState")]
[JsonProperty("birthStateProvince")]
public string BirthProvinceState { get; set; }

/// <summary>
Expand All @@ -82,13 +102,14 @@ public string FullBirthCountry
/// <summary>
/// Is the player currently active in the NHL
/// </summary>
[JsonProperty("isActive")]
[JsonProperty("active")]
public bool IsActive { get; set; }

/// <summary>
/// Date of birth for the NHL player <br/>
/// Example: 1961-01-26
/// </summary>
[Obsolete("This property is not longer available in the NHL API for player search")]
[JsonProperty("birthDate")]
public DateTime BirthDate { get; set; }

Expand All @@ -104,15 +125,51 @@ public string FullBirthCountry
/// The position for the NHL player <br/>
/// Example: C
/// </summary>
[JsonProperty("position")]
[JsonProperty("positionCode")]
public string Position { get; set; }

/// <summary>
/// The jersey number for the NHL player <br/>
/// Example: C
/// </summary>
[JsonProperty("playerNumber")]
public int PlayerNumber { get; set; }
[JsonProperty("sweaterNumber")]
public int? PlayerNumber { get; set; }

/// <summary>
/// The team identifier for the NHL team the NHL player played with <br/>
/// Example: 5
/// </summary>
[JsonProperty("teamId")]
public string TeamId { get; set; }

/// <summary>
/// The team abbreviation for the NHL team the NHL player played with <br/>
/// Example: PIT
/// </summary>
[JsonProperty("teamAbbrev")]
public string TeamAbbreviation { get; set; }

/// <summary>
/// The team name for the NHL team the NHL player played last with <br/>
/// Example: 5
/// </summary>
[JsonProperty("lastTeamId")]
public string LastTeamId { get; set; }

/// <summary>
/// The last team abbreviation for the NHL team the NHL player played with <br/>
/// Example: TOR
/// </summary>
[JsonProperty("lastTeamAbbrev")]
public string LastTeamAbbreviation { get; set; }

/// <summary>
/// The last season identifier for the NHL team the NHL player played with <br/>
/// Example: 20232024
/// </summary>
[JsonProperty("lastSeasonId")]
public object LastSeasonId { get; set; }


}
}
2 changes: 1 addition & 1 deletion Nhl.Api.Domain/Nhl.Api.Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>2.2.0</Version>
<Version>2.2.1</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Nhl.Api.Tests/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

[assembly: Parallelize(Workers = 16, Scope = ExecutionScope.MethodLevel)]
[assembly: Parallelize(Workers = 4, Scope = ExecutionScope.MethodLevel)]
namespace Nhl.Api.Tests
{
internal class AssemblyInfo
Expand Down
7 changes: 4 additions & 3 deletions Nhl.Api.Tests/CachingServiceTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Nhl.Api.Common.Services;
using Nhl.Api.Tests.Helpers.Attributes;
using System.Threading.Tasks;

namespace Nhl.Api.Tests
Expand All @@ -8,7 +9,7 @@ namespace Nhl.Api.Tests
public class CachingServiceTests
{

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestTryAddAsync()
{
ICachingService service = new CachingService();
Expand All @@ -22,7 +23,7 @@ public async Task TestTryAddAsync()
Assert.IsNotNull(retrievedValue);
}

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestTryAddUpdateAsync()
{
ICachingService service = new CachingService();
Expand All @@ -42,7 +43,7 @@ public async Task TestTryAddUpdateAsync()
Assert.AreEqual(retrievedValue, "new value");
}

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestTryRemoveAsync()
{
ICachingService service = new CachingService();
Expand Down
9 changes: 5 additions & 4 deletions Nhl.Api.Tests/ConferenceTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Nhl.Api.Models.Enumerations.Conference;
using Nhl.Api.Tests.Helpers.Attributes;
using System.Threading.Tasks;

namespace Nhl.Api.Tests
Expand All @@ -8,7 +9,7 @@ namespace Nhl.Api.Tests
public class ConferenceTests
{

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestGetConferencesAsync()
{
// Arrange
Expand All @@ -32,7 +33,7 @@ public async Task TestGetConferencesAsync()
}
}

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestGetConferenceByIdAsync()
{
// Arrange
Expand All @@ -50,7 +51,7 @@ public async Task TestGetConferenceByIdAsync()
Assert.IsNotNull(conference.ShortName);
}

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestGetConferenceByIdEnumAsync()
{
// Arrange
Expand All @@ -68,7 +69,7 @@ public async Task TestGetConferenceByIdEnumAsync()
Assert.IsNotNull(conference.ShortName);
}

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestGetConferenceWithInvalidIdAsync()
{
// Arrange
Expand Down
3 changes: 2 additions & 1 deletion Nhl.Api.Tests/CountryCodeHelperTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Nhl.Api.Common.Helpers;
using Nhl.Api.Tests.Helpers.Attributes;

namespace Nhl.Api.Tests
{
Expand Down Expand Up @@ -255,7 +256,7 @@ public class CountryCodeHelperTests
[DataRow("YEM")]
[DataRow("ZMB")]
[DataRow("ZWE")]
[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public void TestCountryCodeHelper(string countryCode)
{
// Act + Arrange
Expand Down
7 changes: 4 additions & 3 deletions Nhl.Api.Tests/DateTimeHelperTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Nhl.Api.Common.Helpers;
using Nhl.Api.Tests.Helpers.Attributes;
using System;

namespace Nhl.Api.Tests
Expand All @@ -12,7 +13,7 @@ public class DateTimeHelperTests
[DataRow("20211105_201423")]
[DataRow("20201015_201423")]
[DataRow("19950210_201423")]
[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public void TestValidDateTimeOffsetHelper(string dateTimeString)
{
// Act/Arrange
Expand All @@ -27,7 +28,7 @@ public void TestValidDateTimeOffsetHelper(string dateTimeString)
[DataRow("19950210_20142423234543")]
[DataRow(" ")]
[DataRow("19950210_201424232_34543")]
[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public void TestInValidDateTimeOffsetHelper(string dateTimeString)
{
// Act/Arrange
Expand All @@ -43,7 +44,7 @@ public void TestInValidDateTimeOffsetHelper(string dateTimeString)
[DataRow("11/11/2003 6:25:13 PM -00:00")]
[DataRow("02/12/1985 3:05:23 PM -04:00")]
[DataRow("08/18/1995 10:05:23 PM +06:00")]
[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public void TestDateTimeOffsetParsesToTimeStampString(string dateTimeOffsetAsString)
{
// Act/Arrange
Expand Down
9 changes: 5 additions & 4 deletions Nhl.Api.Tests/DivisionTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Nhl.Api.Models.Enumerations.Division;
using Nhl.Api.Tests.Helpers.Attributes;
using System.Threading.Tasks;

namespace Nhl.Api.Tests
Expand All @@ -9,7 +10,7 @@ namespace Nhl.Api.Tests
public class DivisionTests
{

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestGetAllDivisionsAsync()
{
// Arrange
Expand All @@ -32,7 +33,7 @@ public async Task TestGetAllDivisionsAsync()
}
}

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestGetDivisionByIdAsync()
{
// Arrange
Expand All @@ -50,7 +51,7 @@ public async Task TestGetDivisionByIdAsync()
Assert.IsNotNull(division.NameShort);
}

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestGetDivisionByIdEnumAsync()
{
// Arrange
Expand All @@ -68,7 +69,7 @@ public async Task TestGetDivisionByIdEnumAsync()
Assert.IsNotNull(division.NameShort);
}

[TestMethod]
[TestMethodWithRetry(RetryCount = 5)]
public async Task TestGetDivisionWithInvalidIdAsync()
{
// Arrange
Expand Down
Loading

0 comments on commit 9aeb46b

Please sign in to comment.