public void Equality() { FungibleAssetValue foo100a = FungibleAssetValue.FromRawValue(FOO, 100); FungibleAssetValue foo100b = FungibleAssetValue.FromRawValue(FOO, 100); FungibleAssetValue foo200a = FungibleAssetValue.FromRawValue(FOO, 200); FungibleAssetValue foo200b = FungibleAssetValue.FromRawValue(FOO, 200); FungibleAssetValue bar100a = FungibleAssetValue.FromRawValue(BAR, 100); FungibleAssetValue bar100b = FungibleAssetValue.FromRawValue(BAR, 100); FungibleAssetValue bar200a = FungibleAssetValue.FromRawValue(BAR, 200); FungibleAssetValue bar200b = FungibleAssetValue.FromRawValue(BAR, 200); Assert.Equal(foo100b, foo100a); Assert.Equal(foo100b.GetHashCode(), foo100a.GetHashCode()); Assert.True(foo100b.Equals((object)foo100a)); Assert.True(foo100b == foo100a); Assert.False(foo100b != foo100a); Assert.Equal(foo200b, foo200a); Assert.Equal(foo200b.GetHashCode(), foo200a.GetHashCode()); Assert.True(foo200b.Equals((object)foo200a)); Assert.True(foo200b == foo200a); Assert.False(foo200b != foo200a); Assert.Equal(bar100b, bar100a); Assert.Equal(bar100b.GetHashCode(), bar100a.GetHashCode()); Assert.True(bar100b.Equals((object)bar100a)); Assert.True(bar100b == bar100a); Assert.False(bar100b != bar100a); Assert.Equal(bar200b, bar200a); Assert.Equal(bar200b.GetHashCode(), bar200a.GetHashCode()); Assert.True(bar200b.Equals((object)bar200a)); Assert.True(bar200b == bar200a); Assert.False(bar200b != bar200a); Assert.NotEqual(foo100a, foo200a); Assert.False(foo100a.Equals((object)foo200a)); Assert.False(foo100a == foo200a); Assert.True(foo100a != foo200a); Assert.NotEqual(foo100a, bar100a); Assert.False(foo100a.Equals((object)bar100a)); Assert.False(foo100a == bar100a); Assert.True(foo100a != bar100a); Assert.NotEqual(foo100a, bar200a); Assert.False(foo100a.Equals((object)bar200a)); Assert.False(foo100a == bar200a); Assert.True(foo100a != bar200a); Assert.NotEqual(bar100a, foo200a); Assert.False(bar100a.Equals((object)foo200a)); Assert.False(bar100a == foo200a); Assert.True(bar100a != foo200a); Assert.NotEqual(foo100a, bar100a); Assert.False(foo100a.Equals((object)bar100a)); Assert.False(foo100a == bar100a); Assert.True(foo100a != bar100a); Assert.NotEqual(foo100a, bar200a); Assert.False(foo100a.Equals((object)bar200a)); Assert.False(foo100a == bar200a); Assert.True(foo100a != bar200a); Assert.False(foo100a.Equals(100)); Assert.False(foo200a.Equals(200)); }
protected bool Equals(OrderDigest other) { return(base.Equals(other) && SellerAgentAddress.Equals(other.SellerAgentAddress) && Price.Equals(other.Price) && CombatPoint == other.CombatPoint && Level == other.Level && ItemId == other.ItemId && ItemCount == other.ItemCount); }
public async void EarnMiningGoldWhenSuccessMining() { var adminPrivateKey = new PrivateKey(); var adminAddress = adminPrivateKey.ToAddress(); var authorizedMinerPrivateKey = new PrivateKey(); (ActivationKey ak, PendingActivationState ps) = ActivationKey.Create( new PrivateKey(), new byte[] { 0x00, 0x01 } ); var blockPolicySource = new BlockPolicySource(Logger.None); IBlockPolicy <PolymorphicAction <ActionBase> > policy = blockPolicySource.GetPolicy( 10_000, null, null, null, null, null, null, null); IStagePolicy <PolymorphicAction <ActionBase> > stagePolicy = new VolatileStagePolicy <PolymorphicAction <ActionBase> >(); Block <PolymorphicAction <ActionBase> > genesis = MakeGenesisBlock( adminAddress, ImmutableHashSet.Create(adminAddress), new AuthorizedMinersState( new[] { authorizedMinerPrivateKey.ToAddress() }, 5, 10 ), pendingActivations: new[] { ps } ); using var store = new DefaultStore(null); using var stateStore = new TrieStateStore(new DefaultKeyValueStore(null)); var blockChain = new BlockChain <PolymorphicAction <ActionBase> >( policy, stagePolicy, store, stateStore, genesis, renderers: new[] { blockPolicySource.BlockRenderer } ); blockChain.MakeTransaction( adminPrivateKey, new PolymorphicAction <ActionBase>[] { new DailyReward(), } ); await blockChain.MineBlock(adminPrivateKey); FungibleAssetValue actualBalance = blockChain.GetBalance(adminAddress, _currency); FungibleAssetValue expectedBalance = new FungibleAssetValue(_currency, 10, 0); Assert.True(expectedBalance.Equals(actualBalance)); }