Skip to content

Commit

Permalink
Merge pull request #141 from neo-ngd/dev
Browse files Browse the repository at this point in the history
Sync
  • Loading branch information
Ashuaidehao committed Aug 19, 2022
2 parents ac2a31c + 210e8ac commit 0cd1fdf
Show file tree
Hide file tree
Showing 63 changed files with 53,976 additions and 30,409 deletions.
2 changes: 1 addition & 1 deletion neo
Submodule neo updated 407 files
10 changes: 8 additions & 2 deletions neo3-gui/neo3-gui.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29409.12
# Visual Studio Version 17
VisualStudioVersion = 17.2.32630.192
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "neo3-gui", "neo3-gui\neo3-gui.csproj", "{2B09B051-9848-4631-81A1-34A81D2E8103}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "neo", "..\neo\src\neo\neo.csproj", "{883A2CF9-BCF3-4B03-895C-63AE54CF292F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "neo3-gui.tests", "neo3-gui.tests\neo3-gui.tests.csproj", "{2F439926-5E57-46FB-979C-43037F95ECC8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Json", "..\neo\src\Neo.Json\Neo.Json.csproj", "{88C3A94F-B476-48E3-9205-D92B6FFFFCCF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -27,6 +29,10 @@ Global
{2F439926-5E57-46FB-979C-43037F95ECC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F439926-5E57-46FB-979C-43037F95ECC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F439926-5E57-46FB-979C-43037F95ECC8}.Release|Any CPU.Build.0 = Release|Any CPU
{88C3A94F-B476-48E3-9205-D92B6FFFFCCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88C3A94F-B476-48E3-9205-D92B6FFFFCCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88C3A94F-B476-48E3-9205-D92B6FFFFCCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88C3A94F-B476-48E3-9205-D92B6FFFFCCF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
94 changes: 94 additions & 0 deletions neo3-gui/neo3-gui.tests/JsonConverter_Test.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Neo;
using Neo.SmartContract;
using Neo.VM;
using Neo.VM.Types;

namespace neo3_gui.tests
{
[TestClass]
public class JsonConverter_Test
{
[TestMethod]
public void Test()
{
var data = "1234".HexToBytes();
StackItem item = new ByteString(data);
var json = item.SerializeJson();
Console.WriteLine(json);
StackItem item2 = json.DeserializeJson<StackItem>();
Assert.AreEqual(json,item2.SerializeJson());

item = new Neo.VM.Types.Buffer(data);
json = item.SerializeJson();
Console.WriteLine(json);
item2 = json.DeserializeJson<StackItem>();
Assert.AreEqual(json, item2.SerializeJson());


item = new Integer(20);
json = item.SerializeJson();
Console.WriteLine(json);
item2 = json.DeserializeJson<StackItem>();
Assert.AreEqual(json, item2.SerializeJson());


item = true;
json = item.SerializeJson();
Console.WriteLine(json);
item2 = json.DeserializeJson<StackItem>();
Assert.AreEqual(json, item2.SerializeJson());


item = new Pointer(data, 1);
json = item.SerializeJson();
Console.WriteLine(json);
item2 = json.DeserializeJson<StackItem>();
Assert.AreEqual(json, item2.SerializeJson());


item = StackItem.Null;
json = item.SerializeJson();
Console.WriteLine(json);
item2 = json.DeserializeJson<StackItem>();
Assert.AreEqual(json, item2.SerializeJson());


var list = new List<StackItem>()
{
1, 2, true, false, data,StackItem.Null
};
item = new Neo.VM.Types.Array(list);
json = item.SerializeJson();
Console.WriteLine(json);
item2 = json.DeserializeJson<StackItem>();
Assert.AreEqual(json, item2.SerializeJson());


item = new Neo.VM.Types.Struct(list);
json = item.SerializeJson();
Console.WriteLine(json);
item2 = json.DeserializeJson<StackItem>();
Assert.AreEqual(json, item2.SerializeJson());


var map = new Neo.VM.Types.Map();
map[1] = true;
map[2] = false;
map["a"] = "A";
map["b"] = StackItem.Null;

item=map;
json = item.SerializeJson();
Console.WriteLine(json);
item2 = json.DeserializeJson<StackItem>();
Assert.AreEqual(json, item2.SerializeJson());

}
}
}
2 changes: 1 addition & 1 deletion neo3-gui/neo3-gui.tests/neo3-gui.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>neo3_gui.tests</RootNamespace>

<IsPackable>false</IsPackable>
Expand Down
Loading

0 comments on commit 0cd1fdf

Please sign in to comment.