diff --git a/JpnCardsPokemon.Tests/Classes/ApiTestClass.cs b/JpnCardsPokemon.Tests/Classes/ApiTestClass.cs new file mode 100644 index 0000000..cc16aad --- /dev/null +++ b/JpnCardsPokemon.Tests/Classes/ApiTestClass.cs @@ -0,0 +1,13 @@ +using JpnCardsPokemonSdk.Client; + +namespace JpnCardsPokemon.Tests.Classes; + +public class ApiTestClass +{ + protected readonly ApiClient Client = new(); + + [SetUp] + public void Setup() + { + } +} \ No newline at end of file diff --git a/JpnCardsPokemon.Tests/Tests/CardTests.cs b/JpnCardsPokemon.Tests/Tests/CardTests.cs new file mode 100644 index 0000000..af82320 --- /dev/null +++ b/JpnCardsPokemon.Tests/Tests/CardTests.cs @@ -0,0 +1,13 @@ +using JpnCardsPokemon.Tests.Classes; + +namespace JpnCardsPokemon.Tests.Tests.Tests; + +public class CardTests : ApiTestClass +{ + [Test] + public async Task TestFetchCards() + { + //var cards = await Client.FetchDataAsync(); + //Assert.IsNotEmpty(cards?.Data); + } +} \ No newline at end of file diff --git a/JpnCardsPokemon.Tests/Tests/QueryFilterTests.cs b/JpnCardsPokemon.Tests/Tests/QueryFilterTests.cs new file mode 100644 index 0000000..9136dfd --- /dev/null +++ b/JpnCardsPokemon.Tests/Tests/QueryFilterTests.cs @@ -0,0 +1,13 @@ +using JpnCardsPokemonSdk.Utils.QueryFilter; + +namespace JpnCardsPokemon.Tests.Tests; + +public class QueryFilterTests +{ + [Test] + public void TestCardQueryFilterBuilder() + { + Assert.That("name=charizard&set_code=s12a", + Is.EqualTo(new CardQueryFilterBuilder { Name = "charizard", SetCode = "s12a" }.BuildQueryString())); + } +} \ No newline at end of file diff --git a/JpnCardsPokemon.Tests/Tests/SetTests.cs b/JpnCardsPokemon.Tests/Tests/SetTests.cs new file mode 100644 index 0000000..2f3bd3e --- /dev/null +++ b/JpnCardsPokemon.Tests/Tests/SetTests.cs @@ -0,0 +1,31 @@ +using JpnCardsPokemon.Tests.Classes; + +namespace JpnCardsPokemon.Tests.Tests; + +public class SetTests : ApiTestClass +{ + [Test] + public async Task TestFetchSets() + { + var sets = await Client.FetchSetsAsync(); + Assert.IsNotEmpty(sets); + } + + [Test] + public async Task TestFetchSetById() + { + // 1 should be Incandescent Arcana (s11a). Hopefully this won't change (: + var set = await Client.FetchSetById(1); + Assert.IsNotNull(set); + Assert.That(set?.SetCode, Is.EqualTo("s11a")); + } + + [Test] + public async Task TestFetchSetByUuid() + { + // 72218005 should be Incandescent Arcana (s11a). Hopefully this won't change (: + var set = await Client.FetchSetByUuid(72218005); + Assert.IsNotNull(set); + Assert.That(set?.SetCode, Is.EqualTo("s11a")); + } +} \ No newline at end of file diff --git a/JpnCardsPokemon.Tests/UnitTest1.cs b/JpnCardsPokemon.Tests/UnitTest1.cs deleted file mode 100644 index 3b824a2..0000000 --- a/JpnCardsPokemon.Tests/UnitTest1.cs +++ /dev/null @@ -1,23 +0,0 @@ -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