-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from planetarium/bugfix/issue-28
Fix AvatarAddrAndScoresWithRank edge case
- Loading branch information
Showing
11 changed files
with
314 additions
and
353 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,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"/> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/> | ||
<PackageReference Include="xunit" Version="2.5.3"/> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="Xunit"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ArenaService\ArenaService\ArenaService.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Large diffs are not rendered by default.
Oops, something went wrong.
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,36 @@ | ||
using Libplanet.Crypto; | ||
|
||
namespace ArenaService.Tests; | ||
|
||
public class AvatarAddressAndScoreTest | ||
{ | ||
[Fact] | ||
public void Except_List() | ||
{ | ||
var address = new PrivateKey().Address; | ||
var address2 = new PrivateKey().Address; | ||
var addressAndScore = new AvatarAddressAndScore(address, 100); | ||
var addressAndScore2 = new AvatarAddressAndScore(address2, 100); | ||
var updated = new AvatarAddressAndScore(address, 200); | ||
|
||
// not equal because score is different | ||
Assert.NotEqual(addressAndScore, updated); | ||
// not equal because address is different | ||
Assert.NotEqual(addressAndScore, addressAndScore2); | ||
|
||
var prev = new List<AvatarAddressAndScore> | ||
{ | ||
addressAndScore, | ||
addressAndScore2, | ||
}; | ||
var next = new List<AvatarAddressAndScore> | ||
{ | ||
updated, | ||
addressAndScore2 | ||
}; | ||
var excepted = Assert.Single(next.Except(prev)); | ||
Assert.Equal(updated.AvatarAddr, excepted.AvatarAddr); | ||
Assert.Equal(updated.Score, excepted.Score); | ||
Assert.Equal(updated, excepted); | ||
} | ||
} |
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
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
Oops, something went wrong.