-
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
11 changed files
with
117 additions
and
12 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 |
---|---|---|
|
@@ -4,3 +4,4 @@ obj/ | |
riderModule.iml | ||
/_ReSharper.Caches/ | ||
.idea/ | ||
*.user |
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,14 @@ | ||
using UnofficialArcaeaAPI.Lib.Models; | ||
|
||
namespace UnofficialArcaeaAPI.Lib.Tests; | ||
|
||
public class TestAssetsApi : TestBase | ||
{ | ||
[Fact] | ||
public async Task TestAff() | ||
{ | ||
var affText = await DefaultClient.Assets.GetAffAsync("inkarusi", AuaSongQueryType.SongId); | ||
|
||
Assert.Contains("arctap", affText); | ||
} | ||
} |
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,17 @@ | ||
namespace UnofficialArcaeaAPI.Lib.Tests; | ||
|
||
public abstract class TestBase | ||
{ | ||
public static string? ApiUrl => Environment.GetEnvironmentVariable("UAA_API_URL"); | ||
public static string? Token => Environment.GetEnvironmentVariable("UAA_TOKEN"); | ||
public static string? UserAgent => "UnofficialArcaeaAPI.Lib Unit Test"; | ||
public static TimeSpan Timeout => TimeSpan.FromSeconds(60); | ||
|
||
public static UaaClient DefaultClient => new(new UaaClientOptions | ||
{ | ||
ApiUrl = ApiUrl, | ||
Token = Token, | ||
UserAgent = UserAgent, | ||
Timeout = Timeout, | ||
}); | ||
} |
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,28 @@ | ||
using UnofficialArcaeaAPI.Lib.Models; | ||
|
||
namespace UnofficialArcaeaAPI.Lib.Tests; | ||
|
||
public class TestUserApi : TestBase | ||
{ | ||
[Fact] | ||
public async Task TestInfo() | ||
{ | ||
var userInfo = await DefaultClient.User.GetInfoAsync("ToasterKoishi", 1, AuaReplyWith.All); | ||
|
||
Assert.True(userInfo.AccountInfo.Rating > 1200); | ||
|
||
Assert.NotNull(userInfo.RecentScore); | ||
Assert.Single(userInfo.RecentScore); | ||
|
||
Assert.NotNull(userInfo.SongInfo); | ||
} | ||
|
||
[Fact] | ||
public async Task TestBestsSession() | ||
{ | ||
var sessionInfo = await DefaultClient.User.GetBestsSessionAsync("ToasterKoishi"); | ||
|
||
Assert.True(sessionInfo.SessionInfo.Contains('@')); | ||
Assert.True(Guid.TryParse(sessionInfo.SessionInfo[2..], out _)); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
UnofficialArcaeaAPI.Lib.Tests/UnofficialArcaeaAPI.Lib.Tests.csproj
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,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" /> | ||
<PackageReference Include="xunit" Version="2.4.2" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.2.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\UnofficialArcaeaAPI.Lib\UnofficialArcaeaAPI.Lib.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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 @@ | ||
global using Xunit; |
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
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
5 changes: 4 additions & 1 deletion
5
UnofficialArcaeaAPI.Lib/Responses/UaaUserBestsSessionContent.cs
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
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
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