Skip to content

Commit

Permalink
test: reuse tests utilities from lib9c
Browse files Browse the repository at this point in the history
  • Loading branch information
moreal committed May 10, 2022
1 parent ceaa1d4 commit 559cc13
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 249 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ jobs:
- name: Install dependencies
run: dotnet restore
- name: Build and test
run: dotnet test --configuration Release --no-restore --verbosity normal
run: |
dotnet test --configuration Release --no-restore --verbosity normal NineChronicles.Headless.Tests
dotnet test --configuration Release --no-restore --verbosity normal NineChronicles.Headless.Executable.Tests
dotnet test --configuration Release --no-restore --verbosity normal Libplanet.Headless.Tests
build-and-test:
needs: [build-and-tests]
Expand Down
2 changes: 1 addition & 1 deletion Libplanet.Headless.Tests/Libplanet.Headless.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.18.0.27296">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Grpc.Core" Version="2.43.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
Expand Down
14 changes: 14 additions & 0 deletions NineChronicles.Headless.Executable.sln
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lib9c.DevExtensions", "Lib9
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Libplanet.Net", "Lib9c\.Libplanet\Libplanet.Net\Libplanet.Net.csproj", "{858AEAB3-CC9C-41C4-9727-4243708FD803}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lib9c.Tests", "Lib9c\.Lib9c.Tests\Lib9c.Tests.csproj", "{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -242,6 +244,18 @@ Global
{858AEAB3-CC9C-41C4-9727-4243708FD803}.Release|x64.Build.0 = Release|Any CPU
{858AEAB3-CC9C-41C4-9727-4243708FD803}.Release|x86.ActiveCfg = Release|Any CPU
{858AEAB3-CC9C-41C4-9727-4243708FD803}.Release|x86.Build.0 = Release|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Debug|x64.ActiveCfg = Debug|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Debug|x64.Build.0 = Debug|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Debug|x86.ActiveCfg = Debug|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Debug|x86.Build.0 = Debug|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Release|Any CPU.Build.0 = Release|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Release|x64.ActiveCfg = Release|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Release|x64.Build.0 = Release|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Release|x86.ActiveCfg = Release|Any CPU
{1DB5C746-0DBD-4D92-BE6D-1DF7536D62B6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
7 changes: 5 additions & 2 deletions NineChronicles.Headless.Tests/Common/Fixtures.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using Lib9c.Model.Order;
using Lib9c.Tests;
using Libplanet;
using Libplanet.Assets;
using Libplanet.Crypto;
Expand All @@ -20,8 +21,10 @@ public static class Fixtures

public static readonly Address AvatarAddress = new Address("983c3Fbfe8243a0e36D55C6C1aE26A7c8Bb6CBd4");

public static readonly TableSheets TableSheetsFX = new TableSheets(TableSheetsImporter.ImportSheets(
Path.Combine("..", "..", "..", "..", "Lib9c", ".Lib9c.Tests", "Data", "TableCSV")));
public static readonly TableSheets TableSheetsFX =
new TableSheets(
TableSheetsImporter.ImportSheets(
Path.Join("..", "..", "..", "..", "Lib9c", "Lib9c", "TableCSV")));

public static readonly AvatarState AvatarStateFX = new AvatarState(
AvatarAddress,
Expand Down
5 changes: 3 additions & 2 deletions NineChronicles.Headless.Tests/GraphTypes/GraphQLTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
using Lib9c.Tests;
using Xunit.Abstractions;
using NCAction = Libplanet.Action.PolymorphicAction<Nekoyume.Action.ActionBase>;

Expand All @@ -41,8 +42,8 @@ public GraphQLTestBase(ITestOutputHelper output)

var goldCurrency = new Currency("NCG", 2, minter: null);

var fixturePath = Path.Combine("..", "..", "..", "..", "Lib9c", ".Lib9c.Tests", "Data", "TableCSV");
var sheets = TableSheetsImporter.ImportSheets(fixturePath);
var sheets =
TableSheetsImporter.ImportSheets(Path.Join("..", "..", "..", "..", "Lib9c", "Lib9c", "TableCSV"));
var blockAction = new RewardGold();
var genesisBlock = BlockChain<NCAction>.MakeGenesisBlock(
HashAlgorithmType.Of<SHA256>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using System.Threading.Tasks;
using Bencodex.Types;
using GraphQL.Execution;
using Lib9c.Tests;
using NineChronicles.Headless.Executable.Commands;
using NineChronicles.Headless.Executable.IO;
using NineChronicles.Headless.Executable.Tests.IO;
Expand All @@ -38,8 +39,7 @@ public class StandaloneMutationTest : GraphQLTestBase

public StandaloneMutationTest(ITestOutputHelper output) : base(output)
{
var fixturePath = Path.Combine("..", "..", "..", "..", "Lib9c", ".Lib9c.Tests", "Data", "TableCSV");
_sheets = TableSheetsImporter.ImportSheets(fixturePath);
_sheets = TableSheetsImporter.ImportSheets(Path.Join("..", "..", "..", "..", "Lib9c", "Lib9c", "TableCSV"));
_tableSheets = new TableSheets(_sheets);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using GraphQL;
using GraphQL.Execution;
using GraphQL.NewtonsoftJson;
using Lib9c.Tests;
using Libplanet;
using Libplanet.Action;
using Libplanet.Assets;
Expand Down Expand Up @@ -42,8 +43,7 @@ public class StandaloneQueryTest : GraphQLTestBase

public StandaloneQueryTest(ITestOutputHelper output) : base(output)
{
var fixturePath = Path.Combine("..", "..", "..", "..", "Lib9c", ".Lib9c.Tests", "Data", "TableCSV");
_sheets = TableSheetsImporter.ImportSheets(fixturePath);
_sheets = TableSheetsImporter.ImportSheets(Path.Join("..", "..", "..", "..", "Lib9c", "Lib9c", "TableCSV"));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.18.0.27296">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -29,6 +29,7 @@
<ProjectReference Include="..\NineChronicles.Headless.Executable.Tests\NineChronicles.Headless.Executable.Tests.csproj" />
<ProjectReference Include="..\NineChronicles.Headless.Executable\NineChronicles.Headless.Executable.csproj" />
<ProjectReference Include="..\NineChronicles.Headless\NineChronicles.Headless.csproj" />
<ProjectReference Include="..\Lib9c\.Lib9c.Tests\Lib9c.Tests.csproj" />
</ItemGroup>

</Project>
207 changes: 0 additions & 207 deletions NineChronicles.Headless.Tests/TableSheets.cs

This file was deleted.

29 changes: 0 additions & 29 deletions NineChronicles.Headless.Tests/TableSheetsImporter.cs

This file was deleted.

0 comments on commit 559cc13

Please sign in to comment.