generated from goatcorp/SamplePlugin
-
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
28 changed files
with
2,757 additions
and
3 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
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
33 changes: 33 additions & 0 deletions
33
EasyTranslate.Integration.Tests/EasyTranslate.Integration.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,33 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0"/> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/> | ||
<PackageReference Include="Snapshooter.Xunit" Version="0.14.1"/> | ||
<PackageReference Include="xunit" Version="2.5.3"/> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\EasyTranslate.Infrastructure\EasyTranslate.Infrastructure.csproj"/> | ||
<ProjectReference Include="..\EasyTranslate.UseCase\EasyTranslate.UseCase.csproj"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Lumina"> | ||
<HintPath>$(DalamudLibPath)\Lumina.dll</HintPath> | ||
<Private>true</Private> | ||
</Reference> | ||
<Reference Include="Lumina.Excel"> | ||
<HintPath>$(DalamudLibPath)\Lumina.Excel.dll</HintPath> | ||
<Private>true</Private> | ||
</Reference> | ||
</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,7 @@ | ||
# EasyTranslate Integration Tests | ||
|
||
These tests require FFXIV to be installed in order to run. | ||
They assume that the GAME_DATA_PATH environment variable is set to the game/sqpack folder of the game files. | ||
Ex: `C:\Program Files (x86)\SquareEnix\FINAL FANTASY XIV- A Realm Reborn\game\sqpack` | ||
|
||
**WARNING**: Since these tests rely on the game's data, they have the potential to fail after any game update! |
235 changes: 235 additions & 0 deletions
235
EasyTranslate.Integration.Tests/SearchContentByNameTest.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using EasyTranslate.Domain.Entities; | ||
using EasyTranslate.UseCase; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Snapshooter.Xunit; | ||
using Xunit; | ||
|
||
namespace EasyTranslate.Integration.Tests; | ||
|
||
// Assertions are done with snapshots | ||
[SuppressMessage("Blocker Code Smell", "S2699:Tests should include assertions")] | ||
public class SearchContentByNameTest | ||
{ | ||
private readonly SearchContentByNameUseCase _searchContentByNameUseCase; | ||
|
||
public SearchContentByNameTest() | ||
{ | ||
IServiceProvider serviceProvider = ServiceProviderBuilder.Build(); | ||
_searchContentByNameUseCase = serviceProvider.GetService<SearchContentByNameUseCase>()!; | ||
} | ||
|
||
[Fact] | ||
public async Task Item_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"Popoto", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Action_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"cure", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
|
||
[Fact] | ||
public async Task Achievement_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"For the hoard", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task BNpcname_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"bhoot", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Companion_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"lesser panda", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task ContentFinderCondition_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"sastasha", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task CraftAction_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"Groundwork", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Emote_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"pet", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task ENpcResident_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"G'raha Tia", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Fate_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"Drink Me", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Leve_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"Practical Command", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Mount_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"Demi-Ozma", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Orchestrion_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"pa-paya", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task PlaceName_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"Limsa Lominsa", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Quest_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"For Want Of a Memory", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Status_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"Vulnerability Up", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Title_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"Goddess of Magic", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Trait_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"Maim and Mend", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
|
||
[Fact] | ||
public async Task Weather_SearchContentByName_ReturnsMatchingResults() | ||
{ | ||
IEnumerable<Content> results = await _searchContentByNameUseCase.Execute( | ||
"Fair Skies", | ||
Language.English | ||
); | ||
|
||
Snapshot.Match(results.ToList()); | ||
} | ||
} |
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,40 @@ | ||
using System; | ||
using EasyTranslate.Infrastructure.Configuration; | ||
using EasyTranslate.UseCase.Configuration; | ||
using Lumina; | ||
using Lumina.Excel; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace EasyTranslate.Integration.Tests; | ||
|
||
public static class ServiceProviderBuilder | ||
{ | ||
private static ServiceProvider? s_serviceProvider; | ||
private static readonly object s_lock = new(); | ||
|
||
public static IServiceProvider Build() | ||
{ | ||
if (s_serviceProvider is not null) | ||
{ | ||
return s_serviceProvider; | ||
} | ||
|
||
lock (s_lock) | ||
{ | ||
string? gameDataPath = Environment.GetEnvironmentVariable("GAME_DATA_PATH"); | ||
if (gameDataPath is null) | ||
{ | ||
throw new InvalidOperationException( | ||
"Please set the GAME_DATA_PATH environment variable as described in the README.md file"); | ||
} | ||
|
||
s_serviceProvider = new ServiceCollection() | ||
.AddUseCaseServices() | ||
.AddInfrastructureServices() | ||
.AddSingleton<ExcelModule>(_ => new GameData(gameDataPath).Excel) | ||
.BuildServiceProvider(); | ||
} | ||
|
||
return s_serviceProvider; | ||
} | ||
} |
Oops, something went wrong.