-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
147 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Threading.Tasks; | ||
using GuildWars2.Tests.TestInfrastructure; | ||
using Xunit; | ||
|
||
namespace GuildWars2.Tests.Features.Currencies; | ||
|
||
public class Currencies | ||
{ | ||
[Fact] | ||
public async Task Can_be_listed() | ||
{ | ||
var sut = Composer.Resolve<Gw2Client>(); | ||
|
||
var actual = await sut.Wallet.GetCurrencies(); | ||
|
||
Assert.Equal(actual.ResultContext.ResultTotal, actual.Value.Count); | ||
Assert.All( | ||
actual.Value, | ||
currency => | ||
{ | ||
currency.Id_is_positive(); | ||
currency.Name_is_not_empty(); | ||
if (currency.Id == 63) | ||
{ | ||
// Astral Acclaim is missing a tooltip | ||
Assert.Empty(currency.Description); | ||
} | ||
else | ||
{ | ||
currency.Description_is_not_empty(); | ||
} | ||
currency.Order_is_positive(); | ||
currency.Icon_is_not_empty(); | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Currencies; | ||
|
||
public class CurrenciesByFilter | ||
{ | ||
[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.Wallet.GetCurrenciesByIds(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) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Threading.Tasks; | ||
using GuildWars2.Tests.TestInfrastructure; | ||
using Xunit; | ||
|
||
namespace GuildWars2.Tests.Features.Currencies; | ||
|
||
public class CurrenciesByPage | ||
{ | ||
[Fact] | ||
public async Task Currencies_can_be_filtered_by_page() | ||
{ | ||
var sut = Composer.Resolve<Gw2Client>(); | ||
|
||
var actual = await sut.Wallet.GetCurrenciesByPage(0, 3); | ||
|
||
Assert.Equal(3, actual.Value.Count); | ||
Assert.Equal(3, actual.PageContext.PageSize); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Currencies; | ||
|
||
public class CurrenciesIndex | ||
{ | ||
[Fact] | ||
public async Task Is_not_empty() | ||
{ | ||
var sut = Composer.Resolve<Gw2Client>(); | ||
|
||
var actual = await sut.Wallet.GetCurrenciesIndex(); | ||
|
||
Assert.Equal(actual.ResultContext.ResultTotal, actual.Value.Count); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Currencies; | ||
|
||
public class CurrencyById | ||
{ | ||
[Fact] | ||
public async Task A_currency_can_be_found_by_id() | ||
{ | ||
var sut = Composer.Resolve<Gw2Client>(); | ||
|
||
const int id = 1; | ||
|
||
var actual = await sut.Wallet.GetCurrencyById(id); | ||
|
||
Assert.Equal(id, actual.Value.Id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using GuildWars2.Tests.TestInfrastructure; | ||
using Xunit; | ||
|
||
namespace GuildWars2.Tests.Features.Currencies; | ||
|
||
public class Wallet | ||
{ | ||
[Fact] | ||
public async Task Can_be_found() | ||
{ | ||
var sut = Composer.Resolve<Gw2Client>(); | ||
var accessToken = Composer.Resolve<ApiKey>(); | ||
var actual = await sut.Wallet.GetWallet(accessToken.Key); | ||
var coins = actual.Value.Single(currency => currency.CurrencyId == 1); | ||
Coin coinsAmount = coins.Amount; | ||
Assert.True(coinsAmount > 0); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.