Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet format #983

Merged
merged 1 commit into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions neo.UnitTests/Consensus/UT_Consensus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public void ConsensusService_Primary_Sends_PrepareRequest_After_OnStart()
Console.WriteLine($"header {header} hash {header.Hash} timestamp {timestampVal}");

timestampVal.Should().Be(328665601001); // GMT: Sunday, June 1, 1980 12:00:01.001 AM
// check basic ConsensusContext
//mockConsensusContext.Object.block_received_time.ToTimestamp().Should().Be(4244941697); //1968-06-01 00:00:01
// check basic ConsensusContext
//mockConsensusContext.Object.block_received_time.ToTimestamp().Should().Be(4244941697); //1968-06-01 00:00:01

// ============================================================================
// creating ConsensusService actor
Expand Down
2 changes: 1 addition & 1 deletion neo.UnitTests/Cryptography/UT_Base58.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class UT_Base58
{
byte[] decoded1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
string encoded1 = "1kA3B2yGe2z4";
byte[] decoded2 = { 0, 0, 0, 0, 0};
byte[] decoded2 = { 0, 0, 0, 0, 0 };
string encoded2 = "1111";

[TestMethod]
Expand Down
8 changes: 4 additions & 4 deletions neo.UnitTests/Cryptography/UT_Cryptography_Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void TestAES256Encrypt()
byte[] key = Encoding.ASCII.GetBytes("1234567812345678");
byte[] result = block.AES256Encrypt(key);
string encryptString = result.ToHexString();
encryptString.Should().Be("f69e0923d8247eef417d6a78944a4b39f69e0923d8247eef417d6a78944a4b39");
encryptString.Should().Be("f69e0923d8247eef417d6a78944a4b39f69e0923d8247eef417d6a78944a4b39");
}

[TestMethod]
Expand Down Expand Up @@ -104,7 +104,7 @@ public void TestAesDecrypt()
byte[] wrongIv = Encoding.ASCII.GetBytes("12345678123456780"); ;
action = () => data.AesDecrypt(key, wrongIv);
action.ShouldThrow<ArgumentException>();
}
}

[TestMethod]
public void TestBase58CheckDecode()
Expand All @@ -126,7 +126,7 @@ public void TestBase58CheckDecode()
[TestMethod]
public void TestSha256()
{
byte[] value = Encoding.ASCII.GetBytes("hello world");
byte[] value = Encoding.ASCII.GetBytes("hello world");
byte[] result = value.Sha256(0, value.Length);
string resultStr = result.ToHexString();
resultStr.Should().Be("b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9");
Expand Down Expand Up @@ -169,7 +169,7 @@ public void TestStringToAesKey()
string password = "hello world";
string string1 = "bc62d4b80d9e36da29c16c5d4d9f11731f36052c72401a76c23c0fb5a9b74423";
byte[] byteArray = new byte[string1.Length / 2];
byteArray = string1.HexToBytes();
byteArray = string1.HexToBytes();
password.ToAesKey().Should().Equal(byteArray);
}

Expand Down
6 changes: 3 additions & 3 deletions neo.UnitTests/Cryptography/UT_MerkleTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class UT_MerkleTree
{
public UInt256 GetByteArrayHash(byte[] byteArray)
{
if(byteArray == null || byteArray.Length == 0) throw new ArgumentNullException();
if (byteArray == null || byteArray.Length == 0) throw new ArgumentNullException();
var hash = new UInt256(Crypto.Default.Hash256(byteArray));
return hash;
}
Expand All @@ -26,13 +26,13 @@ public void TestBuildAndDepthFirstSearch()
action.ShouldThrow<ArgumentException>();

byte[] array1 = { 0x01 };
var hash1 = GetByteArrayHash(array1);
var hash1 = GetByteArrayHash(array1);

byte[] array2 = { 0x02 };
var hash2 = GetByteArrayHash(array2);

byte[] array3 = { 0x03 };
var hash3 = GetByteArrayHash(array3);
var hash3 = GetByteArrayHash(array3);

IReadOnlyList<UInt256> hashes = new UInt256[] { hash1, hash2, hash3 };
MerkleTree tree = new MerkleTree(hashes);
Expand Down
3 changes: 2 additions & 1 deletion neo.UnitTests/IO/Caching/UT_CloneCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public void TestGetInternal()
cloneCache[new MyKey("key2")].Should().Be(new MyValue("value2"));
cloneCache[new MyKey("key3")].Should().Be(new MyValue("value3"));

Action action = () => {
Action action = () =>
{
var item = cloneCache[new MyKey("key4")];
};
action.ShouldThrow<KeyNotFoundException>();
Expand Down
4 changes: 2 additions & 2 deletions neo.UnitTests/IO/Caching/UT_FifoSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public void TestConstructor()
Action action1 = () => new FIFOSet<UInt256>(-1);
action1.ShouldThrow<ArgumentOutOfRangeException>();

Action action2 = () => new FIFOSet<UInt256>(1,-1);
Action action2 = () => new FIFOSet<UInt256>(1, -1);
action2.ShouldThrow<ArgumentOutOfRangeException>();

Action action3 = () => new FIFOSet<UInt256>(1,2);
Action action3 = () => new FIFOSet<UInt256>(1, 2);
action3.ShouldThrow<ArgumentOutOfRangeException>();
}

Expand Down
2 changes: 1 addition & 1 deletion neo.UnitTests/Network/P2P/Payloads/UT_Header.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void Serialize()
byte[] requiredData = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 41, 176, 215, 72, 169, 204, 248, 197, 175, 60, 222, 16, 219, 62, 54, 236, 154, 95, 114, 6, 67, 162, 188, 180, 173, 215, 107, 61, 175, 65, 216, 233, 19, 255, 133, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 81, 0 };

data.Length.Should().Be(requiredData.Length);

for (int i = 0; i < data.Length; i++)
{
data[i].Should().Be(requiredData[i]);
Expand Down
4 changes: 2 additions & 2 deletions neo.UnitTests/VM/UT_Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void TestEmitAppCall1()
tempArray[0] = 0x00;//0
tempArray[1] = 0xC5;//OpCode.NEWARRAY
tempArray[2] = 5;//operation.Length
Array.Copy(Encoding.UTF8.GetBytes("AAAAA"),0, tempArray,3, 5);//operation.data
Array.Copy(Encoding.UTF8.GetBytes("AAAAA"), 0, tempArray, 3, 5);//operation.data
tempArray[8] = 0x14;//scriptHash.Length
Array.Copy(UInt160.Zero.ToArray(), 0, tempArray, 9, 20);//operation.data
uint api = InteropService.System_Contract_Call;
Expand All @@ -42,7 +42,7 @@ public void TestEmitAppCall2()
{
//format:(ContractParameter[])ContractParameter+(byte)OpCode.PACK+(string)operation+(Uint160)scriptHash+(uint)InteropService.System_Contract_Call
ScriptBuilder sb = new ScriptBuilder();
sb.EmitAppCall(UInt160.Zero, "AAAAA",new ContractParameter[] {new ContractParameter(ContractParameterType.Integer)});
sb.EmitAppCall(UInt160.Zero, "AAAAA", new ContractParameter[] { new ContractParameter(ContractParameterType.Integer) });
byte[] tempArray = new byte[35];
tempArray[0] = 0x00;//0
tempArray[1] = 0x51;//ContractParameter.Length
Expand Down
2 changes: 1 addition & 1 deletion neo/Network/RPC/Models/RpcInvokeResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static RpcInvokeResult FromJson(JObject json)
public class RpcStack
{
public string Type { get; set; }

public string Value { get; set; }

public JObject ToJson()
Expand Down
6 changes: 3 additions & 3 deletions neo/Network/RPC/Models/RpcNep5Balances.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Neo.Network.RPC.Models
public class RpcNep5Balances
{
public string Address { get; set; }

public RpcNep5Balance[] Balances { get; set; }

public JObject ToJson()
Expand All @@ -31,9 +31,9 @@ public static RpcNep5Balances FromJson(JObject json)
public class RpcNep5Balance
{
public UInt160 AssetHash { get; set; }

public BigInteger Amount { get; set; }

public uint LastUpdatedBlock { get; set; }

public JObject ToJson()
Expand Down
4 changes: 2 additions & 2 deletions neo/Network/RPC/Models/RpcPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Neo.Network.RPC.Models
public class RpcPlugin
{
public string Name { get; set; }

public string Version { get; set; }

public string[] Interfaces { get; set; }

public JObject ToJson()
Expand Down
6 changes: 3 additions & 3 deletions neo/Network/RPC/Models/RpcRawMemPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ namespace Neo.Network.RPC.Models
public class RpcRawMemPool
{
public uint Height { get; set; }

public string[] Verified { get; set; }

public string[] UnVerified { get; set; }

public JObject ToJson()
{
JObject json = new JObject();
json["height"] = Height;
json["verified"] = new JArray(Verified.Select(p=>(JObject)p));
json["verified"] = new JArray(Verified.Select(p => (JObject)p));
json["unverified"] = new JArray(UnVerified.Select(p => (JObject)p));
return json;
}
Expand Down
6 changes: 3 additions & 3 deletions neo/Network/RPC/Models/RpcRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ namespace Neo.Network.RPC.Models
public class RpcRequest
{
public int Id { get; set; }

public string Jsonrpc { get; set; }

public string Method { get; set; }

public JObject[] Params { get; set; }

public static RpcRequest FromJson(JObject json)
Expand Down
2 changes: 1 addition & 1 deletion neo/Network/RPC/Models/RpcValidateAddressResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Neo.Network.RPC.Models
public class RpcValidateAddressResult
{
public string Address { get; set; }

public bool IsValid { get; set; }

public JObject ToJson()
Expand Down
2 changes: 1 addition & 1 deletion neo/SmartContract/ApplicationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected override bool PreExecuteInstruction()
return true;
return AddGas(OpCodePrices[CurrentContext.CurrentInstruction.OpCode]);
}

private static Block CreateDummyBlock(Snapshot snapshot)
{
var currentBlock = snapshot.Blocks[snapshot.CurrentBlockHash];
Expand Down