forked from neo-project/neo
-
Notifications
You must be signed in to change notification settings - Fork 2
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 neo-project#3 from canesin/core_unit_tests_2
Core unit tests 2
- Loading branch information
Showing
7 changed files
with
478 additions
and
62 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,140 @@ | ||
using Neo.Core; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Neo.UnitTests | ||
{ | ||
public class TestBlockchain : Blockchain | ||
{ | ||
private UInt256 _assetId; | ||
|
||
public TestBlockchain(UInt256 assetId) | ||
{ | ||
_assetId = assetId; | ||
} | ||
|
||
public override UInt256 CurrentBlockHash => throw new NotImplementedException(); | ||
|
||
public override UInt256 CurrentHeaderHash => throw new NotImplementedException(); | ||
|
||
public override uint HeaderHeight => throw new NotImplementedException(); | ||
|
||
public override uint Height => throw new NotImplementedException(); | ||
|
||
public override bool AddBlock(Block block) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override bool ContainsBlock(UInt256 hash) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override bool ContainsTransaction(UInt256 hash) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override bool ContainsUnspent(UInt256 hash, ushort index) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void Dispose() | ||
{ | ||
// do nothing | ||
} | ||
|
||
public override AccountState GetAccountState(UInt160 script_hash) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override AssetState GetAssetState(UInt256 asset_id) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Block GetBlock(UInt256 hash) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override UInt256 GetBlockHash(uint height) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override ContractState GetContract(UInt160 hash) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override IEnumerable<ValidatorState> GetEnrollments() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Header GetHeader(uint height) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Header GetHeader(UInt256 hash) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Block GetNextBlock(UInt256 hash) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override UInt256 GetNextBlockHash(UInt256 hash) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override StorageItem GetStorageItem(StorageKey key) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override long GetSysFeeAmount(UInt256 hash) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Transaction GetTransaction(UInt256 hash, out int height) | ||
{ | ||
height = 0; | ||
return new TestTransaction(_assetId, TransactionType.ClaimTransaction); | ||
} | ||
|
||
public override Dictionary<ushort, SpentCoin> GetUnclaimed(UInt256 hash) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override TransactionOutput GetUnspent(UInt256 hash, ushort index) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override IEnumerable<VoteState> GetVotes(IEnumerable<Transaction> others) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override bool IsDoubleSpend(Transaction tx) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override void AddHeaders(IEnumerable<Header> headers) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
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,18 @@ | ||
using Neo.Core; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Neo.UnitTests | ||
{ | ||
public class TestTransaction : Transaction | ||
{ | ||
public TestTransaction(UInt256 assetId, TransactionType type) : base(type) | ||
{ | ||
TransactionOutput transVal = new TransactionOutput(); | ||
transVal.Value = Fixed8.FromDecimal(50); | ||
transVal.AssetId = assetId; | ||
base.Outputs = new TransactionOutput[1] { transVal }; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
using System.IO; | ||
using System.Text; | ||
using Neo.Core; | ||
using Neo.UnitTest; | ||
|
||
namespace Neo.UnitTests | ||
{ | ||
|
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.