From 7a395e616fe62cebca8c2b342f6651345a6c61b5 Mon Sep 17 00:00:00 2001 From: s2quake Date: Wed, 18 Dec 2024 11:30:03 +0900 Subject: [PATCH] test: Fix build errors in test --- .Lib9c.Tests/Action/Guild/ClaimRewardTest.cs | 4 ++-- .Lib9c.Tests/Action/Guild/GuildTestBase.cs | 2 +- .../MigratePlanetariumValidatorTest.cs | 10 +++++----- .Lib9c.Tests/Action/StakeTest.cs | 2 +- .../AllocateGuildRewardTest.cs | 2 +- .../DelegateValidatorTest.cs | 6 +++--- .../PromoteValidatorTest.cs | 2 +- .../ReleaseValidatorUnbondingsTest.cs | 2 +- .../SetValidatorCommissionTest.cs | 8 ++++---- .../ValidatorDelegation/SlashValidatorTest.cs | 14 ++++++------- .../UndelegateValidatorTest.cs | 20 +++++++++---------- .../UnjailValidatorTest.cs | 2 +- .../UpdateValidatorsTest.cs | 2 +- .../ValidatorDelegationTestBase.cs | 8 ++++---- .Lib9c.Tests/Delegation/DummyDelegatee.cs | 4 ++-- .Lib9c.Tests/Delegation/DummyDelegator.cs | 4 ++-- .Lib9c.Tests/Delegation/DummyRepository.cs | 10 +++++----- .Lib9c.Tests/Delegation/TestDelegatee.cs | 2 +- .Lib9c.Tests/Delegation/TestDelegator.cs | 2 +- .Lib9c.Tests/Delegation/TestRepository.cs | 10 +++++----- 20 files changed, 58 insertions(+), 58 deletions(-) diff --git a/.Lib9c.Tests/Action/Guild/ClaimRewardTest.cs b/.Lib9c.Tests/Action/Guild/ClaimRewardTest.cs index 8a9e537bb8..e5ba128fd4 100644 --- a/.Lib9c.Tests/Action/Guild/ClaimRewardTest.cs +++ b/.Lib9c.Tests/Action/Guild/ClaimRewardTest.cs @@ -249,7 +249,7 @@ private void ExecuteWithFixture(IClaimRewardFixture fixture) // Calculate expected values for comparison with actual values. var expectedRepository = new ValidatorRepository(world, actionContext); var expectedGuildRepository = new GuildRepository(expectedRepository); - var expectedDelegatee = expectedRepository.GetValidatorDelegatee(validatorKey.Address); + var expectedDelegatee = expectedRepository.GetDelegatee(validatorKey.Address); var expectedTotalShares = expectedDelegatee.TotalShares; var expectedValidatorShare = expectedRepository.GetBond(expectedDelegatee, validatorKey.Address).Share; @@ -346,7 +346,7 @@ var expectedProposerReward // Then var validatorRepository = new ValidatorRepository(world, actionContext); var guildRepository = new GuildRepository(world, actionContext); - var delegatee = validatorRepository.GetValidatorDelegatee(validatorKey.Address); + var delegatee = validatorRepository.GetDelegatee(validatorKey.Address); var actualRemainGuildReward = world.GetBalance(delegatee.RewardRemainderPoolAddress, GuildAllocateRewardCurrency); var actualValidatorBalance = world.GetBalance(StakeState.DeriveAddress(validatorKey.Address), DelegationCurrency); var actualValidatorGuildReward = world.GetBalance(validatorKey.Address, GuildAllocateRewardCurrency); diff --git a/.Lib9c.Tests/Action/Guild/GuildTestBase.cs b/.Lib9c.Tests/Action/Guild/GuildTestBase.cs index 922c0fa4c6..eabad4b164 100644 --- a/.Lib9c.Tests/Action/Guild/GuildTestBase.cs +++ b/.Lib9c.Tests/Action/Guild/GuildTestBase.cs @@ -97,7 +97,7 @@ protected static IWorld EnsureToSlashValidator( var guildRepository = new GuildRepository( validatorRepository.World, validatorRepository.ActionContext); - var guildDelegatee = guildRepository.GetGuildDelegatee(validatorAddress); + var guildDelegatee = guildRepository.GetDelegatee(validatorAddress); guildDelegatee.Slash(slashFactor, blockHeight, blockHeight); return guildRepository.World; diff --git a/.Lib9c.Tests/Action/Guild/Migration/MigratePlanetariumValidatorTest.cs b/.Lib9c.Tests/Action/Guild/Migration/MigratePlanetariumValidatorTest.cs index cd15015166..4122d65c4e 100644 --- a/.Lib9c.Tests/Action/Guild/Migration/MigratePlanetariumValidatorTest.cs +++ b/.Lib9c.Tests/Action/Guild/Migration/MigratePlanetariumValidatorTest.cs @@ -36,8 +36,8 @@ public void Execute() var guildRepository = new GuildRepository(world, new ActionContext { }); var validatorRepository = new ValidatorRepository(world, new ActionContext { }); - var guildDelegatee = guildRepository.GetGuildDelegatee(validatorAddress); - var validatorDelegatee = validatorRepository.GetValidatorDelegatee(validatorAddress); + var guildDelegatee = guildRepository.GetDelegatee(validatorAddress); + var validatorDelegatee = validatorRepository.GetDelegatee(validatorAddress); Assert.False(validatorDelegatee.IsActive); Assert.Equal(ValidatorDelegatee.InactiveDelegationPoolAddress, guildDelegatee.DelegationPoolAddress); @@ -55,10 +55,10 @@ public void Execute() guildRepository = new GuildRepository(world, new ActionContext { }); validatorRepository = new ValidatorRepository(world, new ActionContext { }); - guildDelegatee = guildRepository.GetGuildDelegatee(validatorAddress); - validatorDelegatee = validatorRepository.GetValidatorDelegatee(validatorAddress); + guildDelegatee = guildRepository.GetDelegatee(validatorAddress); + validatorDelegatee = validatorRepository.GetDelegatee(validatorAddress); - Assert.True(validatorRepository.GetValidatorDelegatee(validatorAddress).IsActive); + Assert.True(validatorRepository.GetDelegatee(validatorAddress).IsActive); Assert.Equal(ValidatorDelegatee.ActiveDelegationPoolAddress, guildDelegatee.DelegationPoolAddress); Assert.Equal(ValidatorDelegatee.ActiveDelegationPoolAddress, validatorDelegatee.DelegationPoolAddress); Assert.Equal(delegated, world.GetBalance(ValidatorDelegatee.ActiveDelegationPoolAddress, Currencies.GuildGold)); diff --git a/.Lib9c.Tests/Action/StakeTest.cs b/.Lib9c.Tests/Action/StakeTest.cs index c2f2d499f3..58f8c4898c 100644 --- a/.Lib9c.Tests/Action/StakeTest.cs +++ b/.Lib9c.Tests/Action/StakeTest.cs @@ -569,7 +569,7 @@ private IWorld Execute( if (guildRepository.TryGetGuildParticipant(new AgentAddress(signer), out var guildParticipant)) { var guild = guildRepository.GetGuild(guildParticipant.GuildAddress); - var validator = guildRepository.GetGuildDelegatee(guild.ValidatorAddress); + var validator = guildRepository.GetDelegatee(guild.ValidatorAddress); var bond = guildRepository.GetBond(validator, signer); var amountNCG = _ncg * amount; var expectedGG = DelegationUtil.GetGuildCoinFromNCG(amountNCG); diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/AllocateGuildRewardTest.cs b/.Lib9c.Tests/Action/ValidatorDelegation/AllocateGuildRewardTest.cs index 9451670e5b..8a85a4c724 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/AllocateGuildRewardTest.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/AllocateGuildRewardTest.cs @@ -230,7 +230,7 @@ var expectedProposerReward } var validatorAddress = vote.ValidatorPublicKey.Address; - var actualDelegatee = actualRepository.GetValidatorDelegatee(validatorAddress); + var actualDelegatee = actualRepository.GetDelegatee(validatorAddress); var validatorRewardAddress = actualDelegatee.DistributionPoolAddress(); var actualDelegationBalance = world.GetBalance(validatorAddress, DelegationCurrency); var actualCommission = world.GetBalance(validatorAddress, GuildAllocateRewardCurrency); diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/DelegateValidatorTest.cs b/.Lib9c.Tests/Action/ValidatorDelegation/DelegateValidatorTest.cs index 246c1df300..52481ee576 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/DelegateValidatorTest.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/DelegateValidatorTest.cs @@ -64,7 +64,7 @@ public void Execute() // Then var repository = new ValidatorRepository(world, actionContext); - var validator = repository.GetValidatorDelegatee(validatorKey.Address); + var validator = repository.GetDelegatee(validatorKey.Address); var bond = repository.GetBond(validator, validatorKey.Address); var validatorList = repository.GetValidatorList(); @@ -222,7 +222,7 @@ private void ExecuteWithFixture(IDelegateValidatorFixture fixture) // When var expectedRepository = new ValidatorRepository(world, new ActionContext()); - var expectedValidator = expectedRepository.GetValidatorDelegatee(validatorKey.Address); + var expectedValidator = expectedRepository.GetDelegatee(validatorKey.Address); var expectedValidatorBalance = validatorBalance - validatorCash - validatorCashToDelegate; var expectedPower = validatorCash.RawValue + validatorCashToDelegate.RawValue; @@ -237,7 +237,7 @@ private void ExecuteWithFixture(IDelegateValidatorFixture fixture) // Then var actualRepository = new ValidatorRepository(world, actionContext); - var actualValidator = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualValidator = actualRepository.GetDelegatee(validatorKey.Address); var actualValidatorBalance = GetBalance(world, validatorKey.Address); var actualPower = actualValidator.Power; var actualBond = actualRepository.GetBond(actualValidator, validatorKey.Address); diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/PromoteValidatorTest.cs b/.Lib9c.Tests/Action/ValidatorDelegation/PromoteValidatorTest.cs index 81b7d0e1bf..06947c2200 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/PromoteValidatorTest.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/PromoteValidatorTest.cs @@ -45,7 +45,7 @@ public void Execute() // Then var repository = new ValidatorRepository(world, actionContext); - var validator = repository.GetValidatorDelegatee(validatorKey.Address); + var validator = repository.GetDelegatee(validatorKey.Address); var bond = repository.GetBond(validator, validatorKey.Address); var validatorList = repository.GetValidatorList(); diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/ReleaseValidatorUnbondingsTest.cs b/.Lib9c.Tests/Action/ValidatorDelegation/ReleaseValidatorUnbondingsTest.cs index 79b1840e4f..5b961f5790 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/ReleaseValidatorUnbondingsTest.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/ReleaseValidatorUnbondingsTest.cs @@ -38,7 +38,7 @@ public void Execute() // When var expectedRepository = new GuildRepository(world, actionContext); - var expectedDelegatee = expectedRepository.GetGuildDelegatee(validatorKey.Address); + var expectedDelegatee = expectedRepository.GetDelegatee(validatorKey.Address); var expectedUnbondingSet = expectedRepository.GetUnbondingSet(); var expectedReleaseCount = expectedUnbondingSet.UnbondingRefs.Count; var expectedDepositGold = expectedDelegatee.FAVFromShare(share); diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/SetValidatorCommissionTest.cs b/.Lib9c.Tests/Action/ValidatorDelegation/SetValidatorCommissionTest.cs index 1b6ef02a35..5239bb8d3a 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/SetValidatorCommissionTest.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/SetValidatorCommissionTest.cs @@ -83,7 +83,7 @@ public void Execute() // Then var actualRepository = new ValidatorRepository(world, actionContext); - var actualDelegatee = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualDelegatee = actualRepository.GetDelegatee(validatorKey.Address); var actualPercentage = actualDelegatee.CommissionPercentage; Assert.Equal(11, actualPercentage); @@ -119,7 +119,7 @@ public void Execute_Theory(int oldCommissionPercentage, int newCommissionPercent // Then var actualRepository = new ValidatorRepository(world, actionContext); - var actualDelegatee = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualDelegatee = actualRepository.GetDelegatee(validatorKey.Address); var actualPercentage = actualDelegatee.CommissionPercentage; Assert.Equal(newCommissionPercentage, actualPercentage); @@ -235,7 +235,7 @@ public void Execute_Theory_WitValue(int period) // Then var actualRepository = new ValidatorRepository(world, actionContext); - var actualDelegatee = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualDelegatee = actualRepository.GetDelegatee(validatorKey.Address); var actualPercentage = actualDelegatee.CommissionPercentage; Assert.Equal(expectedCommission, actualPercentage); @@ -280,7 +280,7 @@ public void Execute_With_SameValue_Throw() // When var repository = new ValidatorRepository(world, new ActionContext()); - var delegatee = repository.GetValidatorDelegatee(validatorKey.Address); + var delegatee = repository.GetDelegatee(validatorKey.Address); var commissionPercentage = delegatee.CommissionPercentage; var setValidatorCommission = new SetValidatorCommission( commissionPercentage: commissionPercentage); diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/SlashValidatorTest.cs b/.Lib9c.Tests/Action/ValidatorDelegation/SlashValidatorTest.cs index 27699ba63a..437ac8016c 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/SlashValidatorTest.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/SlashValidatorTest.cs @@ -49,7 +49,7 @@ public void Execute() // When var expectedRepository = new ValidatorRepository(world, actionContext); - var expectedDelegatee = expectedRepository.GetValidatorDelegatee(validatorKey.Address); + var expectedDelegatee = expectedRepository.GetDelegatee(validatorKey.Address); var expectedValidatorShare = expectedRepository.GetBond( expectedDelegatee, validatorKey.Address).Share; @@ -96,7 +96,7 @@ public void Execute() // Then var balance = GetBalance(world, validatorKey.Address); var actualRepository = new ValidatorRepository(world, actionContext); - var actualDelegatee = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualDelegatee = actualRepository.GetDelegatee(validatorKey.Address); var actualValidatorShare = actualRepository.GetBond(actualDelegatee, validatorKey.Address).Share; Assert.True(actualDelegatee.Jailed); @@ -165,7 +165,7 @@ public void Execute_ByAbstain() // Then var repository = new ValidatorRepository(world, actionContext); - var delegatee = repository.GetValidatorDelegatee(validatorKey.Address); + var delegatee = repository.GetDelegatee(validatorKey.Address); Assert.True(delegatee.Jailed); Assert.False(delegatee.Tombstoned); } @@ -184,7 +184,7 @@ public void Execute_ToJailedValidator_ThenNothingHappens() // When var expectedRepository = new ValidatorRepository(world, actionContext); - var expectedDelegatee = expectedRepository.GetValidatorDelegatee(validatorKey.Address); + var expectedDelegatee = expectedRepository.GetDelegatee(validatorKey.Address); var expectedJailed = expectedDelegatee.Jailed; var evidence = CreateDuplicateVoteEvidence(validatorKey, height - 1); var lastCommit = new BlockCommit( @@ -205,7 +205,7 @@ public void Execute_ToJailedValidator_ThenNothingHappens() // Then var actualRepository = new ValidatorRepository(world, actionContext); - var actualDelegatee = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualDelegatee = actualRepository.GetDelegatee(validatorKey.Address); var actualJailed = actualDelegatee.Jailed; Assert.Equal(expectedJailed, actualJailed); @@ -224,7 +224,7 @@ public void Execute_ByAbstain_ToJailedValidator_ThenNothingHappens() world = EnsureJailedValidator(world, validatorKey, ref height); var expectedRepository = new ValidatorRepository(world, actionContext); - var expectedDelegatee = expectedRepository.GetValidatorDelegatee(validatorKey.Address); + var expectedDelegatee = expectedRepository.GetDelegatee(validatorKey.Address); var expectedTotalDelegated = expectedDelegatee.TotalDelegated; // When @@ -249,7 +249,7 @@ public void Execute_ByAbstain_ToJailedValidator_ThenNothingHappens() // Then var actualRepisitory = new ValidatorRepository(world, actionContext); - var actualDelegatee = actualRepisitory.GetValidatorDelegatee(validatorKey.Address); + var actualDelegatee = actualRepisitory.GetDelegatee(validatorKey.Address); var actualTotalDelegated = actualDelegatee.TotalDelegated; Assert.True(actualDelegatee.Jailed); diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/UndelegateValidatorTest.cs b/.Lib9c.Tests/Action/ValidatorDelegation/UndelegateValidatorTest.cs index c6638b28ee..d5b82968a8 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/UndelegateValidatorTest.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/UndelegateValidatorTest.cs @@ -53,7 +53,7 @@ public void Execute() // When var expectedRepository = new ValidatorRepository(world, actionContext); - var expectedDelegatee = expectedRepository.GetValidatorDelegatee(validatorKey.Address); + var expectedDelegatee = expectedRepository.GetDelegatee(validatorKey.Address); var expectedBond = expectedRepository.GetBond(expectedDelegatee, validatorKey.Address); var undelegateValidator = new UndelegateValidator(expectedBond.Share); actionContext = new ActionContext @@ -66,7 +66,7 @@ public void Execute() world = undelegateValidator.Execute(actionContext); var actualRepository = new ValidatorRepository(world, actionContext); - var actualDelegatee = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualDelegatee = actualRepository.GetDelegatee(validatorKey.Address); var actualValidatorList = actualRepository.GetValidatorList(); var actualBond = actualRepository.GetBond(actualDelegatee, validatorKey.Address); @@ -182,7 +182,7 @@ public void Execute_FromJailedValidator() BlockIndex = height, }; var expectedRepository = new ValidatorRepository(world, actionContext); - var expectedDelegatee = expectedRepository.GetValidatorDelegatee(validatorKey.Address); + var expectedDelegatee = expectedRepository.GetDelegatee(validatorKey.Address); var expectedBond = expectedRepository.GetBond(expectedDelegatee, validatorKey.Address); var undelegateValidator = new UndelegateValidator(10); @@ -190,7 +190,7 @@ public void Execute_FromJailedValidator() // Then var actualRepository = new ValidatorRepository(world, actionContext); - var actualDelegatee = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualDelegatee = actualRepository.GetDelegatee(validatorKey.Address); var actualBond = actualRepository.GetBond(actualDelegatee, validatorKey.Address); Assert.Equal(expectedBond.Share - 10, actualBond.Share); @@ -215,7 +215,7 @@ public void Execute_FromTombstonedValidator() BlockIndex = height, }; var expectedRepository = new ValidatorRepository(world, actionContext); - var expectedDelegatee = expectedRepository.GetValidatorDelegatee(validatorKey.Address); + var expectedDelegatee = expectedRepository.GetDelegatee(validatorKey.Address); var expectedBond = expectedRepository.GetBond(expectedDelegatee, validatorKey.Address); var undelegateValidator = new UndelegateValidator(10); @@ -223,7 +223,7 @@ public void Execute_FromTombstonedValidator() // Then var actualRepository = new ValidatorRepository(world, actionContext); - var actualDelegatee = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualDelegatee = actualRepository.GetDelegatee(validatorKey.Address); var actualBond = actualRepository.GetBond(actualDelegatee, validatorKey.Address); Assert.Equal(expectedBond.Share - 10, actualBond.Share); @@ -244,7 +244,7 @@ public void Execute_JailsValidatorWhenUndelegationCausesLowDelegation() // When var expectedRepository = new ValidatorRepository(world, actionContext); - var expectedDelegatee = expectedRepository.GetValidatorDelegatee(validatorKey.Address); + var expectedDelegatee = expectedRepository.GetDelegatee(validatorKey.Address); var expectedJailed = expectedDelegatee.Jailed; var undelegateValidator = new UndelegateValidator(10); @@ -258,7 +258,7 @@ public void Execute_JailsValidatorWhenUndelegationCausesLowDelegation() // Then var actualRepository = new ValidatorRepository(world, actionContext); - var actualDelegatee = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualDelegatee = actualRepository.GetDelegatee(validatorKey.Address); var actualJailed = actualDelegatee.Jailed; var actualJailedUntil = actualDelegatee.JailedUntil; @@ -280,7 +280,7 @@ private void ExecuteWithFixture(IUndelegateValidatorFixture fixture) // When var expectedRepository = new ValidatorRepository(world, new ActionContext()); - var expectedValidator = expectedRepository.GetValidatorDelegatee(validatorKey.Address); + var expectedValidator = expectedRepository.GetDelegatee(validatorKey.Address); var expectedValidatorBalance = validatorBalance - validatorCash; var expectedValidatorPower = expectedValidator.Power - fixture.ValidatorInfo.SubtractShare; @@ -296,7 +296,7 @@ private void ExecuteWithFixture(IUndelegateValidatorFixture fixture) // Then var actualRepository = new ValidatorRepository(world, actionContext); - var actualValidator = actualRepository.GetValidatorDelegatee(validatorKey.Address); + var actualValidator = actualRepository.GetDelegatee(validatorKey.Address); var actualValidatorBalance = GetBalance(world, validatorKey.Address); var actualValiatorPower = actualValidator.Power; diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/UnjailValidatorTest.cs b/.Lib9c.Tests/Action/ValidatorDelegation/UnjailValidatorTest.cs index 6bf61fd62e..49916366e1 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/UnjailValidatorTest.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/UnjailValidatorTest.cs @@ -44,7 +44,7 @@ public void Execute() // Then var repository = new ValidatorRepository(world, actionContext); - var delegatee = repository.GetValidatorDelegatee(validatorKey.Address); + var delegatee = repository.GetDelegatee(validatorKey.Address); Assert.False(delegatee.Jailed); Assert.Equal(-1, delegatee.JailedUntil); Assert.False(delegatee.Tombstoned); diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/UpdateValidatorsTest.cs b/.Lib9c.Tests/Action/ValidatorDelegation/UpdateValidatorsTest.cs index 54741e28f9..91379c1287 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/UpdateValidatorsTest.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/UpdateValidatorsTest.cs @@ -90,7 +90,7 @@ public void Execute_ExcludesTombstonedValidator() var actualRepository = new ValidatorRepository(world, actionContext); var actualValidators = actualRepository.GetValidatorList() .ActiveSet().OrderBy(item => item.OperatorAddress).ToList(); - var tombstonedValidator = actualRepository.GetValidatorDelegatee(validatorKeys[0].Address); + var tombstonedValidator = actualRepository.GetDelegatee(validatorKeys[0].Address); Assert.True(tombstonedValidator.Tombstoned); Assert.Equal(expectedValidators.Count - 1, actualValidators.Count); diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs b/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs index d7ace7f651..6a068ccafc 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs @@ -263,7 +263,7 @@ protected static IWorld EnsureJailedValidator( } var repository = new ValidatorRepository(world, new ActionContext()); - var delegatee = repository.GetValidatorDelegatee(validatorKey.Address); + var delegatee = repository.GetDelegatee(validatorKey.Address); if (delegatee.Jailed) { throw new ArgumentException( @@ -282,7 +282,7 @@ protected static IWorld EnsureJailedValidator( world, validatorKey.PublicKey, lastCommit, blockHeight); blockHeight++; repository = new ValidatorRepository(world, new ActionContext()); - delegatee = repository.GetValidatorDelegatee(validatorKey.Address); + delegatee = repository.GetDelegatee(validatorKey.Address); if (delegatee.Jailed) { break; @@ -328,7 +328,7 @@ protected static IWorld EnsureUnjailedValidator( } var repository = new ValidatorRepository(world, new ActionContext()); - var delegatee = repository.GetValidatorDelegatee(validatorKey.Address); + var delegatee = repository.GetDelegatee(validatorKey.Address); if (!delegatee.Jailed) { throw new ArgumentException( @@ -439,7 +439,7 @@ protected static IWorld EnsureCommissionChangedValidator( var cooldown = ValidatorDelegatee.CommissionPercentageUpdateCooldown; var repository = new ValidatorRepository(world, new ActionContext()); - var delegatee = repository.GetValidatorDelegatee(validatorKey.Address); + var delegatee = repository.GetDelegatee(validatorKey.Address); var currentCommission = delegatee.CommissionPercentage; var increment = commissionPercentage > currentCommission ? 1 : -1; var preferredHeight = delegatee.CommissionPercentageLastUpdateHeight + cooldown; diff --git a/.Lib9c.Tests/Delegation/DummyDelegatee.cs b/.Lib9c.Tests/Delegation/DummyDelegatee.cs index 1ffaa83a82..9a417d35de 100644 --- a/.Lib9c.Tests/Delegation/DummyDelegatee.cs +++ b/.Lib9c.Tests/Delegation/DummyDelegatee.cs @@ -3,9 +3,9 @@ using Libplanet.Types.Assets; using Nekoyume.Delegation; -public sealed class DummyDelegatee : Delegatee +public sealed class DummyDelegatee : Delegatee { - public DummyDelegatee(Address address, IDelegationRepository repository) + public DummyDelegatee(Address address, DummyRepository repository) : base(address, repository) { } diff --git a/.Lib9c.Tests/Delegation/DummyDelegator.cs b/.Lib9c.Tests/Delegation/DummyDelegator.cs index d7b0223f56..91f8ff0698 100644 --- a/.Lib9c.Tests/Delegation/DummyDelegator.cs +++ b/.Lib9c.Tests/Delegation/DummyDelegator.cs @@ -1,9 +1,9 @@ using Libplanet.Crypto; using Nekoyume.Delegation; -public sealed class DummyDelegator : Delegator +public sealed class DummyDelegator : Delegator { - public DummyDelegator(Address address, IDelegationRepository repository) + public DummyDelegator(Address address, DummyRepository repository) : base(address, repository) { } diff --git a/.Lib9c.Tests/Delegation/DummyRepository.cs b/.Lib9c.Tests/Delegation/DummyRepository.cs index 2293822e19..2395975a0a 100644 --- a/.Lib9c.Tests/Delegation/DummyRepository.cs +++ b/.Lib9c.Tests/Delegation/DummyRepository.cs @@ -7,7 +7,7 @@ namespace Nekoyume.Delegation using Libplanet.Types.Assets; using Nekoyume.Action; - public class DummyRepository : DelegationRepository + public class DummyRepository : DelegationRepository { public DummyRepository(IWorld world, IActionContext context) : base( @@ -50,10 +50,10 @@ public override DummyDelegator GetDelegator(Address address) } } - public override void SetDelegatee(IDelegatee delegatee) - => SetDelegateeMetadata(((DummyDelegatee)delegatee).Metadata); + public override void SetDelegatee(DummyDelegatee delegatee) + => SetDelegateeMetadata(delegatee.Metadata); - public override void SetDelegator(IDelegator delegator) - => SetDelegatorMetadata(((DummyDelegator)delegator).Metadata); + public override void SetDelegator(DummyDelegator delegator) + => SetDelegatorMetadata(delegator.Metadata); } } diff --git a/.Lib9c.Tests/Delegation/TestDelegatee.cs b/.Lib9c.Tests/Delegation/TestDelegatee.cs index f1cfc67963..673d5e8778 100644 --- a/.Lib9c.Tests/Delegation/TestDelegatee.cs +++ b/.Lib9c.Tests/Delegation/TestDelegatee.cs @@ -4,7 +4,7 @@ namespace Lib9c.Tests.Delegation using Libplanet.Types.Assets; using Nekoyume.Delegation; - public sealed class TestDelegatee : Delegatee + public sealed class TestDelegatee : Delegatee { public TestDelegatee(Address address, TestRepository repository) : base(address, repository) diff --git a/.Lib9c.Tests/Delegation/TestDelegator.cs b/.Lib9c.Tests/Delegation/TestDelegator.cs index fa1c4c2e99..a5beaa1eaf 100644 --- a/.Lib9c.Tests/Delegation/TestDelegator.cs +++ b/.Lib9c.Tests/Delegation/TestDelegator.cs @@ -3,7 +3,7 @@ namespace Lib9c.Tests.Delegation using Libplanet.Crypto; using Nekoyume.Delegation; - public sealed class TestDelegator : Delegator + public sealed class TestDelegator : Delegator { public TestDelegator(Address address, TestRepository repo) : base(address, repo) diff --git a/.Lib9c.Tests/Delegation/TestRepository.cs b/.Lib9c.Tests/Delegation/TestRepository.cs index ccd60898c6..d7c68796f8 100644 --- a/.Lib9c.Tests/Delegation/TestRepository.cs +++ b/.Lib9c.Tests/Delegation/TestRepository.cs @@ -8,7 +8,7 @@ namespace Nekoyume.Delegation using Libplanet.Types.Assets; using Nekoyume.Action; - public class TestRepository : DelegationRepository + public class TestRepository : DelegationRepository { private readonly IActionContext _context; @@ -54,11 +54,11 @@ public override TestDelegator GetDelegator(Address address) } } - public override void SetDelegatee(IDelegatee delegatee) - => SetDelegateeMetadata(((TestDelegatee)delegatee).Metadata); + public override void SetDelegatee(TestDelegatee delegatee) + => SetDelegateeMetadata(delegatee.Metadata); - public override void SetDelegator(IDelegator delegator) - => SetDelegatorMetadata(((TestDelegator)delegator).Metadata); + public override void SetDelegator(TestDelegator delegator) + => SetDelegatorMetadata(delegator.Metadata); public void MintAsset(Address recipient, FungibleAssetValue value) => previousWorld = previousWorld.MintAsset(_context, recipient, value);