diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/AllocateRewardTest.cs b/.Lib9c.Tests/Action/ValidatorDelegation/AllocateRewardTest.cs index 432fd8f751..c0850d9438 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/AllocateRewardTest.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/AllocateRewardTest.cs @@ -132,6 +132,7 @@ public void Execute_WithoutReward_Throw() [InlineData(1181126949)] [InlineData(793705868)] [InlineData(707058493)] + [InlineData(37149681)] public void Execute_Theory_WithStaticSeed(int randomSeed) { var fixture = new RandomFixture(randomSeed); @@ -301,12 +302,13 @@ public RandomFixture(int randomSeed) ValidatorsInfos = CreateArray(_random.Next(1, 200), i => { var balance = GetRandomFAV(DelegationCurrency, _random); - var flag = _random.Next() % 2 == 0 ? VoteFlag.PreCommit : VoteFlag.Null; + var cash = GetRandomCash(_random, balance); + var flag = i == 0 || _random.Next() % 2 == 0 ? VoteFlag.PreCommit : VoteFlag.Null; return new ValidatorInfo { Key = new PrivateKey(), - Balance = balance, - Cash = GetRandomCash(_random, balance), + Balance = balance < MinimumDelegation ? MinimumDelegation : balance, + Cash = cash < MinimumDelegation ? MinimumDelegation : cash, VoteFlag = flag, }; }); diff --git a/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs b/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs index 7ad175762b..ad40712287 100644 --- a/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs +++ b/.Lib9c.Tests/Action/ValidatorDelegation/ValidatorDelegationTestBase.cs @@ -45,12 +45,12 @@ public ValidatorDelegationTestBase() protected static BlockHash EmptyBlockHash { get; } = new BlockHash(CreateArray(BlockHash.Size, _ => (byte)0x01)); + protected static FungibleAssetValue MinimumDelegation { get; } = DelegationCurrency * 10; + protected PrivateKey AdminKey { get; } = new PrivateKey(); protected IWorld World { get; } - protected FungibleAssetValue MinimumDelegation { get; } = DelegationCurrency * 10; - protected static T[] CreateArray(int length, Func creator) => Enumerable.Range(0, length).Select(creator).ToArray();