Skip to content

Commit

Permalink
Reorganize Specializations tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sliekens committed Sep 16, 2023
1 parent 790c7e8 commit 01fb12f
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 77 deletions.
20 changes: 20 additions & 0 deletions GW2SDK.Tests/Features/Specializations/SpecializationById.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Threading.Tasks;
using GuildWars2.Tests.TestInfrastructure;
using Xunit;

namespace GuildWars2.Tests.Features.Specializations;

public class SpecializationById
{
[Fact]
public async Task Can_be_found()
{
var sut = Composer.Resolve<Gw2Client>();

const int id = 1;

var actual = await sut.Specializations.GetSpecializationById(id);

Assert.Equal(id, actual.Value.Id);
}
}
32 changes: 32 additions & 0 deletions GW2SDK.Tests/Features/Specializations/Specializations.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Threading.Tasks;
using GuildWars2.Tests.TestInfrastructure;
using Xunit;

namespace GuildWars2.Tests.Features.Specializations;

public class Specializations
{
[Fact]
public async Task Specializations_can_be_listed()
{
var sut = Composer.Resolve<Gw2Client>();

var actual = await sut.Specializations.GetSpecializations();

Assert.Equal(actual.ResultContext.ResultTotal, actual.Value.Count);
Assert.All(
actual.Value,
specialization =>
{
specialization.Id_is_positive();
specialization.Name_is_not_empty();
specialization.It_has_minor_traits();
specialization.It_has_major_traits();
specialization.Icon_is_not_empty();
specialization.Background_is_not_empty();
specialization.Big_profession_icon_is_not_null();
specialization.Profession_icon_is_not_null();
}
);
}
}
31 changes: 31 additions & 0 deletions GW2SDK.Tests/Features/Specializations/SpecializationsByFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using GuildWars2.Tests.TestInfrastructure;
using Xunit;

namespace GuildWars2.Tests.Features.Specializations;

public class SpecializationsByFilter
{
[Fact]
public async Task Can_be_filtered_by_id()
{
var sut = Composer.Resolve<Gw2Client>();

HashSet<int> ids = new()
{
1,
2,
3
};

var actual = await sut.Specializations.GetSpecializationsByIds(ids);

Assert.Collection(
ids,
first => Assert.Contains(actual.Value, found => found.Id == first),
second => Assert.Contains(actual.Value, found => found.Id == second),
third => Assert.Contains(actual.Value, found => found.Id == third)
);
}
}
18 changes: 18 additions & 0 deletions GW2SDK.Tests/Features/Specializations/SpecializationsIndex.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Threading.Tasks;
using GuildWars2.Tests.TestInfrastructure;
using Xunit;

namespace GuildWars2.Tests.Features.Specializations;

public class SpecializationsIndex
{
[Fact]
public async Task Is_not_empty()
{
var sut = Composer.Resolve<Gw2Client>();

var actual = await sut.Specializations.GetSpecializationsIndex();

Assert.Equal(actual.ResultContext.ResultTotal, actual.Value.Count);
}
}
77 changes: 0 additions & 77 deletions GW2SDK.Tests/Features/Specializations/SpecializationsQueryTest.cs

This file was deleted.

0 comments on commit 01fb12f

Please sign in to comment.