Skip to content

Commit

Permalink
Reorganize Inventories tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sliekens committed Sep 16, 2023
1 parent c4f3325 commit 0bd8e17
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 65 deletions.
45 changes: 45 additions & 0 deletions GW2SDK.Tests/Features/Inventories/Inventory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System.Threading.Tasks;
using GuildWars2.Tests.TestInfrastructure;
using Xunit;

namespace GuildWars2.Tests.Features.Inventories;

public class Inventory
{
[Fact]
public async Task Can_be_found_by_character_name()
{
var sut = Composer.Resolve<Gw2Client>();
var character = Composer.Resolve<TestCharacter>();
var accessToken = Composer.Resolve<ApiKey>();

var actual = await sut.Inventory.GetInventory(character.Name, accessToken.Key);

Assert.NotNull(actual.Value);
Assert.NotEmpty(actual.Value.Bags);
Assert.All(
actual.Value.Bags,
bag =>
{
if (bag is not null)
{
Assert.True(bag.Id > 0);
Assert.True(bag.Size > 0);
Assert.Equal(bag.Size, bag.Inventory.Count);
Assert.All(
bag.Inventory,
slot =>
{
if (slot is not null)
{
Assert.True(slot.Id > 0);
Assert.True(slot.Count > 0);
}
}
);
}
}
);
}

}
30 changes: 30 additions & 0 deletions GW2SDK.Tests/Features/Inventories/SharedInventory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Threading.Tasks;
using GuildWars2.Tests.TestInfrastructure;
using Xunit;

namespace GuildWars2.Tests.Features.Inventories;

public class SharedInventory
{
[Fact]
public async Task Can_be_listed()
{
var sut = Composer.Resolve<Gw2Client>();
var accessToken = Composer.Resolve<ApiKey>();

var actual = await sut.Inventory.GetSharedInventory(accessToken.Key);

Assert.NotEmpty(actual.Value);
Assert.All(
actual.Value,
slot =>
{
if (slot is not null)
{
Assert.True(slot.Id > 0);
Assert.True(slot.Count > 0);
}
}
);
}
}
65 changes: 0 additions & 65 deletions GW2SDK.Tests/Features/InventoryQueryTest.cs

This file was deleted.

0 comments on commit 0bd8e17

Please sign in to comment.