From adf942550c5dd2defa8440038f8a2daad145d630 Mon Sep 17 00:00:00 2001 From: Shargon Date: Mon, 2 Mar 2020 19:19:11 +0100 Subject: [PATCH] Fix coverage results (#192) * Add UT * Fix namespaces and coverage * change exclude * fix quotes --- .github/workflows/main.yml | 4 ++-- .../TestClasses/Contract1.cs | 2 +- .../TestClasses/Contract2.cs | 2 +- .../TestClasses/Contract_Array.cs | 2 +- .../TestClasses/Contract_Event.cs | 2 +- .../TestClasses/Contract_MultipleContracts.cs | 2 +- .../TestClasses/Contract_MultipleContracts2.cs | 2 +- .../TestClasses/Contract_NULL.cs | 15 ++++++++++++++- .../TestClasses/Contract_StaticVar.cs | 2 +- .../TestClasses/Contract_StaticVarInit.cs | 2 +- .../TestClasses/Contract_Switch6.cs | 2 +- .../TestClasses/Contract_SwitchLong.cs | 2 +- .../TestClasses/Contract_WrongEvent.cs | 4 ++-- .../TestClasses/Contract_appcall.cs | 2 +- .../TestClasses/Contract_autoentrypoint.cs | 2 +- .../TestClasses/Contract_shift.cs | 2 +- .../TestClasses/Contract_shift_bigint.cs | 2 +- .../TestClasses/NoContract.cs | 2 -- tests/Neo.Compiler.MSIL.UnitTests/UnitTest1.cs | 4 ++-- .../UnitTest_ABI_Event.cs | 5 ++--- .../UnitTest_Appcall.cs | 4 ++-- .../Neo.Compiler.MSIL.UnitTests/UnitTest_Array.cs | 4 ++-- .../UnitTest_AutoEntrypoint.cs | 4 ++-- .../UnitTest_EntryPoints.cs | 4 ++-- .../Neo.Compiler.MSIL.UnitTests/UnitTest_NULL.cs | 15 +++++++++++++-- .../Neo.Compiler.MSIL.UnitTests/UnitTest_Shift.cs | 4 ++-- .../UnitTest_StaticVar.cs | 4 ++-- .../UnitTest_Switch.cs | 4 ++-- .../Utils/BuildScript.cs | 2 +- .../Utils/DefLogger.cs | 2 +- .../Utils/NeonTestTool.cs | 2 +- .../Utils/TestDataCache.cs | 2 +- .../Utils/TestEngine.cs | 2 +- .../Utils/TestMetaDataCache.cs | 2 +- .../Utils/TestSnapshot.cs | 2 +- .../Utils/TestStorageContext.cs | 2 +- tests/Neo.Compiler.MSIL.UnitTests/Utils/base58.cs | 5 +---- .../FeatureTest.cs | 2 +- .../Services/Neo/AccountTest.cs | 2 +- .../Services/Neo/BlockchainTest.cs | 2 +- .../Services/Neo/ContractTest.cs | 2 +- .../Services/Neo/CryptoTest.cs | 2 +- .../Services/Neo/EnumeratorTest.cs | 2 +- .../Services/Neo/IteratorTest.cs | 2 +- .../Services/Neo/JsonTest.cs | 2 +- .../Services/Neo/NativeTest.cs | 2 +- .../Services/Neo/RuntimeTest.cs | 2 +- .../Services/Neo/StorageTest.cs | 2 +- .../Services/System/ExecutionEngineTest.cs | 4 ++-- 49 files changed, 85 insertions(+), 67 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9c2eedf5d..0f680fb8c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,9 +26,9 @@ jobs: - name: Add package coverlet.msbuild run: find tests -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild - name: Test Neo.Compiler.MSIL.UnitTests - run: dotnet test tests/Neo.Compiler.MSIL.UnitTests /p:CollectCoverage=true /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/ /p:Exclude="[Neo.SmartContract.*]*" + run: dotnet test tests/Neo.Compiler.MSIL.UnitTests /p:CollectCoverage=true /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/ /p:Exclude=\"[Neo.SmartContract.*]*,[Neo.Compiler.MSIL.UnitTests]*,[Neo.Compiler.MSIL.UnitTests.*]*\" - name: Test Neo.SmartContract.Framework.UnitTests - run: dotnet test tests/Neo.SmartContract.Framework.UnitTests /p:CollectCoverage=true /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/lcov /p:MergeWith=${GITHUB_WORKSPACE}/coverage/coverage.json /p:Exclude="[Neo.SmartContract.*]*" /p:CoverletOutputFormat=lcov + run: dotnet test tests/Neo.SmartContract.Framework.UnitTests /p:CollectCoverage=true /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/lcov /p:MergeWith=${GITHUB_WORKSPACE}/coverage/coverage.json /p:Exclude=\"[Neo.SmartContract.*]*,[Neo.Compiler.MSIL.UnitTests]*,[Neo.Compiler.MSIL.UnitTests.*]*\" /p:CoverletOutputFormat=lcov - name: Coveralls uses: coverallsapp/github-action@master with: diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract1.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract1.cs index 3d1404fe8..84ee25ffa 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract1.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract1.cs @@ -1,4 +1,4 @@ -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { public class Contract1 : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract2.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract2.cs index 9168d68ca..f915054d4 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract2.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract2.cs @@ -1,4 +1,4 @@ -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { public class Contract2 : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Array.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Array.cs index 727231fe2..06eff6cae 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Array.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Array.cs @@ -3,7 +3,7 @@ using System.Text; using System.Numerics; -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { struct State { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Event.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Event.cs index 8edc65c10..36be68962 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Event.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Event.cs @@ -2,7 +2,7 @@ using System.ComponentModel; using System.Numerics; -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { public class Contract_Event : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_MultipleContracts.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_MultipleContracts.cs index 44dd46f1a..20bfadbdc 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_MultipleContracts.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_MultipleContracts.cs @@ -1,6 +1,6 @@ using Neo.SmartContract.Framework; -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_a : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_MultipleContracts2.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_MultipleContracts2.cs index 5d467f539..b6595057b 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_MultipleContracts2.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_MultipleContracts2.cs @@ -1,6 +1,6 @@ using Neo.SmartContract.Framework; -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_a : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_NULL.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_NULL.cs index 54a8f6ae1..ec5cc34dd 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_NULL.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_NULL.cs @@ -1,6 +1,7 @@ using Neo.SmartContract.Framework.Services.Neo; using Neo.SmartContract.Framework; -namespace Neo.Compiler.MSIL.TestClasses + +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_NULL : SmartContract.Framework.SmartContract { @@ -40,10 +41,22 @@ public static string NullCollation(string code) string myname = code ?? "linux"; return myname; } + + public static bool IfNull(object obj) + { + if ((bool)obj) + { + return true; + } + + return false; + } + public static object NullCollationAndCollation(string code) { return Storage.Get(code)?.AsBigInteger() ?? 123; } + public static object NullCollationAndCollation2(string code) { Storage.Put(code, "111"); diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_StaticVar.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_StaticVar.cs index 2b3c8b76a..43177c9eb 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_StaticVar.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_StaticVar.cs @@ -1,4 +1,4 @@ -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_staticvar : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_StaticVarInit.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_StaticVarInit.cs index fd36cc87e..7a2a61834 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_StaticVarInit.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_StaticVarInit.cs @@ -1,6 +1,6 @@ using Neo.SmartContract.Framework.Services.System; -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_staticvar : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Switch6.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Switch6.cs index 80b5ea48c..d4dcb9946 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Switch6.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_Switch6.cs @@ -1,4 +1,4 @@ -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_SwitchValid : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_SwitchLong.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_SwitchLong.cs index 15fd1194a..703c74249 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_SwitchLong.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_SwitchLong.cs @@ -1,4 +1,4 @@ -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_SwitchInvalid : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_WrongEvent.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_WrongEvent.cs index b771a56e0..4f6d8a750 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_WrongEvent.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_WrongEvent.cs @@ -1,6 +1,6 @@ -using System.ComponentModel; +using System.ComponentModel; -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { public class Contract_WrongEvent : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_appcall.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_appcall.cs index fa2b9323c..a831d5809 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_appcall.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_appcall.cs @@ -1,6 +1,6 @@ using Neo.SmartContract.Framework; -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_syscall : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_autoentrypoint.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_autoentrypoint.cs index b95caa30c..2891db1cf 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_autoentrypoint.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_autoentrypoint.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Text; -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_autoentrypoint : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_shift.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_shift.cs index aa5a1087e..4360a8a4f 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_shift.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_shift.cs @@ -1,4 +1,4 @@ -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_shift : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_shift_bigint.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_shift_bigint.cs index 4ca6638ae..8045438ae 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_shift_bigint.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_shift_bigint.cs @@ -1,4 +1,4 @@ -namespace Neo.Compiler.MSIL.TestClasses +namespace Neo.Compiler.MSIL.UnitTests.TestClasses { class Contract_shift_bigint : SmartContract.Framework.SmartContract { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/NoContract.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/NoContract.cs index dc2a02ec4..e4f99e2e4 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/NoContract.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/NoContract.cs @@ -1,5 +1,3 @@ -using Neo.SmartContract.Framework; - namespace Neo.Compiler.MSIL.TestClasses { class NoContract diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest1.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest1.cs index b33763e48..21dde0e6a 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest1.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest1.cs @@ -1,9 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.VM.Types; using System; -namespace Neo.Compiler.MSIL +namespace Neo.Compiler.MSIL.UnitTests { [TestClass] public class UnitTest1 diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_ABI_Event.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_ABI_Event.cs index ca00d65f0..946513130 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_ABI_Event.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_ABI_Event.cs @@ -1,9 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; -using Neo.VM; +using Neo.Compiler.MSIL.UnitTests.Utils; using System; -namespace Neo.Compiler.MSIL +namespace Neo.Compiler.MSIL.UnitTests { [TestClass] public class UnitTest_ABI_Event diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Appcall.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Appcall.cs index 84060c345..32761824d 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Appcall.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Appcall.cs @@ -1,8 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.VM.Types; -namespace Neo.Compiler.MSIL +namespace Neo.Compiler.MSIL.UnitTests { [TestClass] public class UnitTest_AppCall diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Array.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Array.cs index 43a3bf1d0..c082375d4 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Array.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Array.cs @@ -1,9 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.VM.Types; using System.Linq; -namespace Neo.Compiler.MSIL +namespace Neo.Compiler.MSIL.UnitTests { [TestClass] public class UnitTest_Array diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_AutoEntrypoint.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_AutoEntrypoint.cs index 967e3d2a4..982008713 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_AutoEntrypoint.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_AutoEntrypoint.cs @@ -1,9 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.VM; using Neo.VM.Types; -namespace Neo.Compiler.MSIL +namespace Neo.Compiler.MSIL.UnitTests { [TestClass] public class UnitTest_AutoEntryPoint diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_EntryPoints.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_EntryPoints.cs index 82b8cf8be..f868397a9 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_EntryPoints.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_EntryPoints.cs @@ -1,7 +1,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; -namespace Neo.Compiler.MSIL +namespace Neo.Compiler.MSIL.UnitTests { [TestClass] public class UnitTest_EntryPoints diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_NULL.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_NULL.cs index 84d87a921..8fefecaca 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_NULL.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_NULL.cs @@ -1,9 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.SmartContract.Manifest; using Neo.VM.Types; -namespace Neo.Compiler.MSIL +namespace Neo.Compiler.MSIL.UnitTests { [TestClass] public class UnitTest_NULL @@ -39,6 +39,17 @@ public void IsNull() Assert.IsFalse(item.ToBoolean()); } + [TestMethod] + public void IfNull() + { + testengine.Reset(); + var result = testengine.ExecuteTestCaseStandard("ifNull", StackItem.Null); + var item = result.Pop(); + + Assert.IsInstanceOfType(item, typeof(Integer)); + Assert.IsFalse(item.ToBoolean()); + } + [TestMethod] public void NullCoalescing() { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Shift.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Shift.cs index 85c61d458..f07397778 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Shift.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Shift.cs @@ -1,11 +1,11 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.SmartContract; using System; using System.Collections.Generic; using System.Numerics; -namespace Neo.Compiler.MSIL +namespace Neo.Compiler.MSIL.UnitTests { [TestClass] public class UnitTest_Shift diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_StaticVar.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_StaticVar.cs index 6ecc9b83f..333625349 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_StaticVar.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_StaticVar.cs @@ -1,8 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.VM.Types; -namespace Neo.Compiler.MSIL +namespace Neo.Compiler.MSIL.UnitTests { [TestClass] public class UnitTest_StaticVar diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Switch.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Switch.cs index 6b2df40b7..2e00fbe4e 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Switch.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_Switch.cs @@ -1,8 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.VM; -namespace Neo.Compiler.MSIL +namespace Neo.Compiler.MSIL.UnitTests { [TestClass] public class UnitTest_Switch diff --git a/tests/Neo.Compiler.MSIL.UnitTests/Utils/BuildScript.cs b/tests/Neo.Compiler.MSIL.UnitTests/Utils/BuildScript.cs index 89de04bbf..6b8fa0ab8 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/Utils/BuildScript.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/Utils/BuildScript.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.IO; -namespace Neo.Compiler.MSIL.Utils +namespace Neo.Compiler.MSIL.UnitTests.Utils { public class BuildScript { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/Utils/DefLogger.cs b/tests/Neo.Compiler.MSIL.UnitTests/Utils/DefLogger.cs index c44f93f0e..35e82ada5 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/Utils/DefLogger.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/Utils/DefLogger.cs @@ -1,6 +1,6 @@ using System; -namespace Neo.Compiler.MSIL.Utils +namespace Neo.Compiler.MSIL.UnitTests.Utils { internal class DefLogger : ILogger { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/Utils/NeonTestTool.cs b/tests/Neo.Compiler.MSIL.UnitTests/Utils/NeonTestTool.cs index 75eadb11f..291dd8948 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/Utils/NeonTestTool.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/Utils/NeonTestTool.cs @@ -3,7 +3,7 @@ using System.Security.Cryptography; using System.Text; -namespace Neo.Compiler.MSIL.Utils +namespace Neo.Compiler.MSIL.UnitTests.Utils { internal static class NeonTestTool { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestDataCache.cs b/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestDataCache.cs index 82f5094df..6e205bdab 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestDataCache.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestDataCache.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; -namespace Neo.Compiler.MSIL.Utils +namespace Neo.Compiler.MSIL.UnitTests.Utils { public class TestDataCache : DataCache where TKey : IEquatable, ISerializable diff --git a/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestEngine.cs b/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestEngine.cs index c25439ce3..fcbedc16c 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestEngine.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestEngine.cs @@ -6,7 +6,7 @@ using System; using System.Collections.Generic; -namespace Neo.Compiler.MSIL.Utils +namespace Neo.Compiler.MSIL.UnitTests.Utils { public class TestEngine : ApplicationEngine { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestMetaDataCache.cs b/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestMetaDataCache.cs index 42c4655fc..327088cf7 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestMetaDataCache.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestMetaDataCache.cs @@ -1,7 +1,7 @@ using Neo.IO; using Neo.IO.Caching; -namespace Neo.Compiler.MSIL.Utils +namespace Neo.Compiler.MSIL.UnitTests.Utils { public class TestMetaDataCache : MetaDataCache where T : class, ICloneable, ISerializable, new() { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestSnapshot.cs b/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestSnapshot.cs index 58fc01313..852c517e6 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestSnapshot.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestSnapshot.cs @@ -4,7 +4,7 @@ using Neo.Network.P2P.Payloads; using Neo.Persistence; -namespace Neo.Compiler.MSIL.Utils +namespace Neo.Compiler.MSIL.UnitTests.Utils { public class TestSnapshot : StoreView { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestStorageContext.cs b/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestStorageContext.cs index e0872a35c..83f1baedd 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestStorageContext.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/Utils/TestStorageContext.cs @@ -1,4 +1,4 @@ -namespace Neo.Compiler.MSIL.Utils +namespace Neo.Compiler.MSIL.UnitTests.Utils { class TestStorageContext { diff --git a/tests/Neo.Compiler.MSIL.UnitTests/Utils/base58.cs b/tests/Neo.Compiler.MSIL.UnitTests/Utils/base58.cs index c34d03124..b4c75f8e1 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/Utils/base58.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/Utils/base58.cs @@ -1,12 +1,9 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Numerics; -using System.Security.Cryptography; using System.Text; -using System.Threading.Tasks; -namespace ThinNeo.Cryptography.Cryptography +namespace Neo.Compiler.MSIL.UnitTests.Utils { public static class Base58 { diff --git a/tests/Neo.SmartContract.Framework.UnitTests/FeatureTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/FeatureTest.cs index cfdf12cf1..19fbd3611 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/FeatureTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/FeatureTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using System.Linq; namespace Neo.SmartContract.Framework.UnitTests diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/AccountTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/AccountTest.cs index f2025c97f..10f259fa5 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/AccountTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/AccountTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.Ledger; using Neo.VM.Types; diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/BlockchainTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/BlockchainTest.cs index c660f3738..6fdfd8dd5 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/BlockchainTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/BlockchainTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.IO; using Neo.Ledger; using Neo.VM; diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/ContractTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/ContractTest.cs index c837f92e7..59b513be6 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/ContractTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/ContractTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.IO; using Neo.SmartContract.Manifest; using Neo.VM; diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/CryptoTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/CryptoTest.cs index 81b6b954a..b2adbc754 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/CryptoTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/CryptoTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.Cryptography; using Neo.Network.P2P; using Neo.Network.P2P.Payloads; diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/EnumeratorTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/EnumeratorTest.cs index b6a910431..8ba7589fc 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/EnumeratorTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/EnumeratorTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.VM; using Neo.VM.Types; diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/IteratorTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/IteratorTest.cs index 517b11f02..7462187d0 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/IteratorTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/IteratorTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.VM; using Neo.VM.Types; diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/JsonTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/JsonTest.cs index 6fb6d2dc4..e5c0ae9bb 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/JsonTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/JsonTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.VM; using Neo.VM.Types; using System.Text; diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/NativeTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/NativeTest.cs index aa8e79d43..753c1c3cd 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/NativeTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/NativeTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.VM; using Neo.VM.Types; diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/RuntimeTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/RuntimeTest.cs index 9109956a2..37d68bf97 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/RuntimeTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/RuntimeTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.IO; using Neo.Network.P2P.Payloads; using Neo.Persistence; diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/StorageTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/StorageTest.cs index ca94cd8d7..a882d3b0d 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/StorageTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/Neo/StorageTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.Ledger; using Neo.VM.Types; using System; diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/System/ExecutionEngineTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/System/ExecutionEngineTest.cs index 7a61bdef2..9cef818ca 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/System/ExecutionEngineTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/System/ExecutionEngineTest.cs @@ -1,5 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Neo.Compiler.MSIL.Utils; +using Neo.Compiler.MSIL.UnitTests.Utils; using Neo.IO; using Neo.Network.P2P.Payloads; using Neo.Persistence; @@ -47,7 +47,7 @@ public void SerializeUnsigned(BinaryWriter writer) [TestInitialize] public void Init() { - _engine = new TestEngine(SmartContract.TriggerType.Application, new DummyVerificable()); + _engine = new TestEngine(TriggerType.Application, new DummyVerificable()); _engine.AddEntryScript("./TestClasses/Contract_ExecutionEngine.cs"); scriptHash = _engine.ScriptEntry.finalNEF.ToScriptHash().ToArray().ToHexString(); }