Reorganizes test classes and adds simple test for queryfilterbuilder

This commit is contained in:
Serraniel 2023-03-01 17:29:39 +01:00
parent 70159b11ba
commit d55b6eea02
Signed by: Serraniel
GPG key ID: 3690B4E7364525D3
5 changed files with 70 additions and 23 deletions

View file

@ -0,0 +1,13 @@
using JpnCardsPokemonSdk.Client;
namespace JpnCardsPokemon.Tests.Classes;
public class ApiTestClass
{
protected readonly ApiClient Client = new();
[SetUp]
public void Setup()
{
}
}

View file

@ -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<Card>();
//Assert.IsNotEmpty(cards?.Data);
}
}

View file

@ -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()));
}
}

View file

@ -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"));
}
}

View file

@ -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<Set>();
Assert.IsNotEmpty(sets?.Data);
// Assert.Pass();
}
}
}