-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Simple characters.json tests and automatic builds
- Loading branch information
Showing
5 changed files
with
107 additions
and
8 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using GIMI_ModManager.Core.Services; | ||
|
||
namespace JASM.Tests | ||
{ | ||
public class CharactersJsonTests | ||
{ | ||
private readonly string AssetsUriPath = Path.GetFullPath("..\\..\\..\\..\\GIMI-ModManager.WinUI\\Assets"); | ||
|
||
private async Task<IGenshinService> InitGenshinService() | ||
{ | ||
if (!File.Exists(AssetsUriPath + "\\characters.json")) | ||
throw new FileNotFoundException("Assets file not found.", AssetsUriPath); | ||
var genshinService = new GenshinService(); | ||
await genshinService.InitializeAsync(AssetsUriPath); | ||
return genshinService; | ||
} | ||
|
||
[Fact] | ||
public async void CheckFor_DuplicateCharacterIds() | ||
{ | ||
var genshinService = await InitGenshinService(); | ||
var characters = genshinService.GetCharacters(); | ||
|
||
var duplicateIds = characters.GroupBy(character => character.Id).Where(g => g.Count() > 1); | ||
|
||
Assert.Empty(duplicateIds); | ||
} | ||
|
||
|
||
[Fact] | ||
public async void CheckFor_DuplicateNames() | ||
{ | ||
var genshinService = await InitGenshinService(); | ||
var characters = genshinService.GetCharacters(); | ||
|
||
var duplicateNames = characters.GroupBy(character => character.DisplayName.ToLower()) | ||
.Where(g => g.Count() > 1); | ||
|
||
Assert.Empty(duplicateNames); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.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="..\GIMI-ModManager.Core\GIMI-ModManager.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |