Skip to content

Commit

Permalink
Upgrade dependencies and target frameworks (#1178)
Browse files Browse the repository at this point in the history
* Upgrade dependencies and target frameworks

* Update neo.csproj

* Remove BOM

* Restore net47 and Neo.VM v3.0.0-CI00042

* Remove net47

* Microsoft.EntityFrameworkCore.Sqlite v3.0.0

* Fix some of the tests

* Revert "Microsoft.EntityFrameworkCore.Sqlite v3.0.0"

This reverts commit b1c9d09.

* Neo.VM v3.0.0-CI00046

* Remove before_script

* FormatException

* Fixes

* Fixes

* Fix

* Update neo.csproj

* Neo.VM v3.0.0-CI00051

* Upgrade dependencies

* Disable warnings

* Upgrade UT dependencies

* Update neo.csproj

* Neo.VM v3.0.0-CI00170
  • Loading branch information
shargon authored and lock9 committed Nov 24, 2019
1 parent 5327f6b commit a891796
Show file tree
Hide file tree
Showing 56 changed files with 279 additions and 250 deletions.
20 changes: 7 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,27 @@ language: csharp

os:
- linux
- osx

dist: bionic
osx_image: xcode9.1

mono: none
dotnet: 2.2.402
dotnet: 3.0.100

env:
- TEST_SUITE="without-cultures"
- TEST_SUITE="cultures"

before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ulimit -n 2048; fi
install:
- dotnet tool install -g dotnet-format --version 4.0.40103 --add-source https://dotnet.myget.org/F/format/api/v3/index.json
- dotnet tool install -g dotnet-format
- export PATH="$PATH:$HOME/.dotnet/tools"
- dotnet-format --version
before_script:
- echo "Checking format..."
- dotnet format --check --dry-run -w . -v diagnostic # check C# formatting for neo.sln
- cd neo.UnitTests
script: |
echo "Checking format..."
dotnet format --check --dry-run -w . -v diagnostic # check C# formatting for neo.sln
cd neo.UnitTests
if [[ "$TEST_SUITE" == "cultures" ]]; then
dotnet test -v m --filter FullyQualifiedName=Neo.UnitTests.UT_Culture.All_Tests_Cultures
else
if [[ "$TEST_SUITE" == "without-cultures" && "$TRAVIS_OS_NAME" == "linux" ]]; then
if [[ "$TEST_SUITE" == "without-cultures" ]]; then
# Test & Calculate coverage
find * -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild
dotnet test -v m --filter FullyQualifiedName!=Neo.UnitTests.UT_Culture.All_Tests_Cultures /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
Expand All @@ -38,7 +32,7 @@ script: |
fi
fi
after_success: |
if [[ "$TEST_SUITE" == "without-cultures" && "$TRAVIS_OS_NAME" == "linux" ]]; then
if [[ "$TEST_SUITE" == "without-cultures" ]]; then
# Send coverage
echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)"
bash <(curl -s https://codecov.io/bash) -v
Expand Down
1 change: 1 addition & 0 deletions neo.UnitTests/Extensions/NativeContractExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Neo.SmartContract;
using Neo.SmartContract.Native;
using Neo.VM;
using Neo.VM.Types;
using System;

namespace Neo.UnitTests.Extensions
Expand Down
9 changes: 4 additions & 5 deletions neo.UnitTests/Extensions/Nep5NativeContractExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace Neo.UnitTests.Extensions
{
Expand Down Expand Up @@ -65,7 +64,7 @@ public static bool Transfer(this NativeContract contract, Persistence.Snapshot s
var result = engine.ResultStack.Pop();
result.Should().BeOfType(typeof(VM.Types.Boolean));

return (result as VM.Types.Boolean).GetBoolean();
return result.ToBoolean();
}

public static string[] SupportedStandards(this NativeContract contract)
Expand All @@ -86,7 +85,7 @@ public static string[] SupportedStandards(this NativeContract contract)
result.Should().BeOfType(typeof(VM.Types.Array));

return (result as VM.Types.Array).ToArray()
.Select(u => Encoding.ASCII.GetString(u.GetByteArray()))
.Select(u => u.GetString())
.ToArray();
}

Expand Down Expand Up @@ -168,7 +167,7 @@ public static string Symbol(this NativeContract contract)
var result = engine.ResultStack.Pop();
result.Should().BeOfType(typeof(VM.Types.ByteArray));

return Encoding.UTF8.GetString((result as VM.Types.ByteArray).GetByteArray());
return result.GetString();
}

public static string Name(this NativeContract contract)
Expand All @@ -188,7 +187,7 @@ public static string Name(this NativeContract contract)
var result = engine.ResultStack.Pop();
result.Should().BeOfType(typeof(VM.Types.ByteArray));

return Encoding.UTF8.GetString((result as VM.Types.ByteArray).GetByteArray());
return result.GetString();
}
}
}
14 changes: 7 additions & 7 deletions neo.UnitTests/Network/P2P/Payloads/UT_Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void FeeIsMultiSigContract()
engine.LoadScript(witness.InvocationScript);
Assert.AreEqual(VMState.HALT, engine.Execute());
Assert.AreEqual(1, engine.ResultStack.Count);
Assert.IsTrue(engine.ResultStack.Pop().GetBoolean());
Assert.IsTrue(engine.ResultStack.Pop().ToBoolean());
verificationGas += engine.GasConsumed;
}
}
Expand Down Expand Up @@ -246,7 +246,7 @@ public void FeeIsSignatureContractDetailed()
engine.LoadScript(witness.InvocationScript);
Assert.AreEqual(VMState.HALT, engine.Execute());
Assert.AreEqual(1, engine.ResultStack.Count);
Assert.IsTrue(engine.ResultStack.Pop().GetBoolean());
Assert.IsTrue(engine.ResultStack.Pop().ToBoolean());
verificationGas += engine.GasConsumed;
}
}
Expand Down Expand Up @@ -364,7 +364,7 @@ public void FeeIsSignatureContract_TestScope_Global()
engine.LoadScript(witness.InvocationScript);
Assert.AreEqual(VMState.HALT, engine.Execute());
Assert.AreEqual(1, engine.ResultStack.Count);
Assert.IsTrue(engine.ResultStack.Pop().GetBoolean());
Assert.IsTrue(engine.ResultStack.Pop().ToBoolean());
verificationGas += engine.GasConsumed;
}
}
Expand Down Expand Up @@ -456,7 +456,7 @@ public void FeeIsSignatureContract_TestScope_CurrentHash_GAS()
engine.LoadScript(witness.InvocationScript);
Assert.AreEqual(VMState.HALT, engine.Execute());
Assert.AreEqual(1, engine.ResultStack.Count);
Assert.IsTrue(engine.ResultStack.Pop().GetBoolean());
Assert.IsTrue(engine.ResultStack.Pop().ToBoolean());
verificationGas += engine.GasConsumed;
}
}
Expand Down Expand Up @@ -551,7 +551,7 @@ public void FeeIsSignatureContract_TestScope_CalledByEntry_Plus_GAS()
engine.LoadScript(witness.InvocationScript);
Assert.AreEqual(VMState.HALT, engine.Execute());
Assert.AreEqual(1, engine.ResultStack.Count);
Assert.IsTrue(engine.ResultStack.Pop().GetBoolean());
Assert.IsTrue(engine.ResultStack.Pop().ToBoolean());
verificationGas += engine.GasConsumed;
}
}
Expand Down Expand Up @@ -706,7 +706,7 @@ public void FeeIsSignatureContract_TestScope_CurrentHash_NEO_GAS()
engine.LoadScript(witness.InvocationScript);
Assert.AreEqual(VMState.HALT, engine.Execute());
Assert.AreEqual(1, engine.ResultStack.Count);
Assert.IsTrue(engine.ResultStack.Pop().GetBoolean());
Assert.IsTrue(engine.ResultStack.Pop().ToBoolean());
verificationGas += engine.GasConsumed;
}
}
Expand Down Expand Up @@ -1054,7 +1054,7 @@ public void FeeIsSignatureContract_TestScope_Global_Default()
engine.LoadScript(witness.InvocationScript);
Assert.AreEqual(VMState.HALT, engine.Execute());
Assert.AreEqual(1, engine.ResultStack.Count);
Assert.IsTrue(engine.ResultStack.Pop().GetBoolean());
Assert.IsTrue(engine.ResultStack.Pop().ToBoolean());
verificationGas += engine.GasConsumed;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Neo.SmartContract.Enumerators;
using Neo.SmartContract.Iterators;
using Neo.VM;
using Neo.VM.Types;
using System;
using System.Collections.Generic;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Neo.SmartContract.Enumerators;
using Neo.SmartContract.Iterators;
using Neo.VM;
using Neo.VM.Types;
using System;
using System.Collections.Generic;

Expand Down
11 changes: 5 additions & 6 deletions neo.UnitTests/SmartContract/Iterators/UT_MapWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Neo.SmartContract.Iterators;
using Neo.VM;
using Neo.VM.Types;
using System;
using System.Collections.Generic;
Expand All @@ -14,7 +13,7 @@ public class UT_MapWrapper
[TestMethod]
public void TestGeneratorAndDispose()
{
MapWrapper mapWrapper = new MapWrapper(new List<KeyValuePair<StackItem, StackItem>>());
MapWrapper mapWrapper = new MapWrapper(new List<KeyValuePair<PrimitiveType, StackItem>>());
Assert.IsNotNull(mapWrapper);
Action action = () => mapWrapper.Dispose();
action.Should().NotThrow<Exception>();
Expand All @@ -23,10 +22,10 @@ public void TestGeneratorAndDispose()
[TestMethod]
public void TestKeyAndValue()
{
List<KeyValuePair<StackItem, StackItem>> list = new List<KeyValuePair<StackItem, StackItem>>();
StackItem stackItem1 = new Integer(0);
List<KeyValuePair<PrimitiveType, StackItem>> list = new List<KeyValuePair<PrimitiveType, StackItem>>();
Integer stackItem1 = new Integer(0);
StackItem stackItem2 = new Integer(1);
list.Add(new KeyValuePair<StackItem, StackItem>(stackItem1, stackItem2));
list.Add(new KeyValuePair<PrimitiveType, StackItem>(stackItem1, stackItem2));
MapWrapper mapWrapper = new MapWrapper(list);
mapWrapper.Next();
Assert.AreEqual(stackItem1, mapWrapper.Key());
Expand All @@ -36,7 +35,7 @@ public void TestKeyAndValue()
[TestMethod]
public void TestNext()
{
MapWrapper mapWrapper = new MapWrapper(new List<KeyValuePair<StackItem, StackItem>>());
MapWrapper mapWrapper = new MapWrapper(new List<KeyValuePair<PrimitiveType, StackItem>>());
Assert.AreEqual(false, mapWrapper.Next());
}
}
Expand Down
Loading

0 comments on commit a891796

Please sign in to comment.