Skip to content

Commit

Permalink
Merge pull request neo-project#3 from canesin/core_unit_tests_2
Browse files Browse the repository at this point in the history
Core unit tests 2
  • Loading branch information
canesin authored Jul 14, 2017
2 parents e3ef0ec + 3b727d5 commit bbf3eb3
Show file tree
Hide file tree
Showing 7 changed files with 478 additions and 62 deletions.
140 changes: 140 additions & 0 deletions neo.UnitTests/TestBlockchain.cs
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();
}
}
}
18 changes: 18 additions & 0 deletions neo.UnitTests/TestTransaction.cs
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 };
}
}
}
8 changes: 1 addition & 7 deletions neo.UnitTests/TestUtils.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Neo.UnitTest
namespace Neo.UnitTests
{
public static class TestUtils
{
Expand Down
1 change: 0 additions & 1 deletion neo.UnitTests/UT_AccountState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.IO;
using System.Text;
using Neo.Core;
using Neo.UnitTest;

namespace Neo.UnitTests
{
Expand Down
6 changes: 1 addition & 5 deletions neo.UnitTests/UT_AssetState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
using Neo.Cryptography.ECC;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Neo.UnitTest
namespace Neo.UnitTests
{
[TestClass]
public class UT_AssetState
Expand Down
Loading

0 comments on commit bbf3eb3

Please sign in to comment.