Reorganizes test classes and adds simple test for queryfilterbuilder
This commit is contained in:
parent
70159b11ba
commit
d55b6eea02
13
JpnCardsPokemon.Tests/Classes/ApiTestClass.cs
Normal file
13
JpnCardsPokemon.Tests/Classes/ApiTestClass.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
using JpnCardsPokemonSdk.Client;
|
||||||
|
|
||||||
|
namespace JpnCardsPokemon.Tests.Classes;
|
||||||
|
|
||||||
|
public class ApiTestClass
|
||||||
|
{
|
||||||
|
protected readonly ApiClient Client = new();
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
13
JpnCardsPokemon.Tests/Tests/CardTests.cs
Normal file
13
JpnCardsPokemon.Tests/Tests/CardTests.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
13
JpnCardsPokemon.Tests/Tests/QueryFilterTests.cs
Normal file
13
JpnCardsPokemon.Tests/Tests/QueryFilterTests.cs
Normal 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()));
|
||||||
|
}
|
||||||
|
}
|
31
JpnCardsPokemon.Tests/Tests/SetTests.cs
Normal file
31
JpnCardsPokemon.Tests/Tests/SetTests.cs
Normal 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"));
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue