From ea22696f663812ce701f866d385b2c9aec8e1269 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Sun, 12 Feb 2023 23:06:21 +0100 Subject: [PATCH 1/3] Adds a placeholder testing project --- .../JpnCardsPokemon.Tests.csproj | 23 +++++++++++++++++++ JpnCardsPokemon.Tests/UnitTest1.cs | 23 +++++++++++++++++++ JpnCardsPokemon.Tests/Usings.cs | 1 + JpnCardsPokemonSdk.sln | 6 +++++ 4 files changed, 53 insertions(+) create mode 100644 JpnCardsPokemon.Tests/JpnCardsPokemon.Tests.csproj create mode 100644 JpnCardsPokemon.Tests/UnitTest1.cs create mode 100644 JpnCardsPokemon.Tests/Usings.cs diff --git a/JpnCardsPokemon.Tests/JpnCardsPokemon.Tests.csproj b/JpnCardsPokemon.Tests/JpnCardsPokemon.Tests.csproj new file mode 100644 index 0000000..c8cc251 --- /dev/null +++ b/JpnCardsPokemon.Tests/JpnCardsPokemon.Tests.csproj @@ -0,0 +1,23 @@ + + + + net7.0 + enable + enable + + false + + + + + + + + + + + + + + + diff --git a/JpnCardsPokemon.Tests/UnitTest1.cs b/JpnCardsPokemon.Tests/UnitTest1.cs new file mode 100644 index 0000000..3b824a2 --- /dev/null +++ b/JpnCardsPokemon.Tests/UnitTest1.cs @@ -0,0 +1,23 @@ +using JpnCardsPokemonSdk.Api; +using JpnCardsPokemonSdk.Client; + +namespace JpnCardsPokemon.Tests +{ + public class Tests + { + private ApiClient Client = new ApiClient(); + + [SetUp] + public void Setup() + { + } + + [Test] + public async Task TestFetchSets() + { + var sets = await Client.FetchDataAsync(); + Assert.IsNotEmpty(sets?.Data); + // Assert.Pass(); + } + } +} \ No newline at end of file diff --git a/JpnCardsPokemon.Tests/Usings.cs b/JpnCardsPokemon.Tests/Usings.cs new file mode 100644 index 0000000..cefced4 --- /dev/null +++ b/JpnCardsPokemon.Tests/Usings.cs @@ -0,0 +1 @@ +global using NUnit.Framework; \ No newline at end of file diff --git a/JpnCardsPokemonSdk.sln b/JpnCardsPokemonSdk.sln index 1f2208c..e767054 100644 --- a/JpnCardsPokemonSdk.sln +++ b/JpnCardsPokemonSdk.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.5.33318.248 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JpnCardsPokemonSdk", "src\JpnCardsPokemonSdk.csproj", "{D5C0B825-C6F2-48BB-B4C8-E416B545151E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JpnCardsPokemon.Tests", "JpnCardsPokemon.Tests\JpnCardsPokemon.Tests.csproj", "{13AA15F0-0CCD-4B59-A235-5DFB5C0B6C74}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {D5C0B825-C6F2-48BB-B4C8-E416B545151E}.Debug|Any CPU.Build.0 = Debug|Any CPU {D5C0B825-C6F2-48BB-B4C8-E416B545151E}.Release|Any CPU.ActiveCfg = Release|Any CPU {D5C0B825-C6F2-48BB-B4C8-E416B545151E}.Release|Any CPU.Build.0 = Release|Any CPU + {13AA15F0-0CCD-4B59-A235-5DFB5C0B6C74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {13AA15F0-0CCD-4B59-A235-5DFB5C0B6C74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {13AA15F0-0CCD-4B59-A235-5DFB5C0B6C74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {13AA15F0-0CCD-4B59-A235-5DFB5C0B6C74}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 10cd18261d0609a6e9759be663a3cce588742415 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Sun, 12 Feb 2023 23:07:19 +0100 Subject: [PATCH 2/3] Fixes accessability of the Data property on Enumerableapiresponse --- src/Client/Responses/EnumerableApiResponse.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client/Responses/EnumerableApiResponse.cs b/src/Client/Responses/EnumerableApiResponse.cs index 2cbe2ec..4e6b926 100644 --- a/src/Client/Responses/EnumerableApiResponse.cs +++ b/src/Client/Responses/EnumerableApiResponse.cs @@ -15,7 +15,7 @@ public class EnumerableApiResponse : IApiResponse>, (IPageableApiResponse, IEnumerable>)this).TotalCount / ( (IPageableApiResponse, IEnumerable>)this).PageSize); - IEnumerable? IApiResponse>.Data { get; set; } + public IEnumerable? Data { get; set; } ApiClient? IPageableApiResponse, IEnumerable>.CurrentApiClient { get; set; } From bf32379254796e0d713c609aa1d0c0aca16e1250 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Sun, 12 Feb 2023 23:07:40 +0100 Subject: [PATCH 3/3] Registers the set endpoint in the endpoint factory --- src/Api/Set.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Api/Set.cs b/src/Api/Set.cs index 9358072..5cd5c11 100644 --- a/src/Api/Set.cs +++ b/src/Api/Set.cs @@ -5,6 +5,11 @@ namespace JpnCardsPokemonSdk.Api; public class Set : EndpointObject { + static Set() + { + EndpointFactory.RegisterTypeEndpoint(new SetEndpoint()); + } + public string? Name { get; set; } public int Id { get; set; }