-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
687 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
test/AElf.Contracts.SolidityContract.Tests/ContractTests/DelegateCallContractTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
test/AElf.Contracts.SolidityContract.Tests/ContractTests/DestructTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Threading.Tasks; | ||
using AElf.Types; | ||
using Scale; | ||
using Shouldly; | ||
using Xunit.Abstractions; | ||
|
||
namespace AElf.Contracts.SolidityContract; | ||
|
||
public class DestructTests : SolidityContractTestBase | ||
{ | ||
private readonly ITestOutputHelper _outputHelper; | ||
|
||
public DestructTests(ITestOutputHelper outputHelper) : base(outputHelper) | ||
{ | ||
_outputHelper = outputHelper; | ||
ContractPath = "contracts/destruct.contract"; | ||
} | ||
|
||
[Fact] | ||
public async Task HelloTest() | ||
{ | ||
var contractAddress = await DeployContractAsync(); | ||
var txResult = await ExecuteTransactionAsync(contractAddress, "hello"); | ||
txResult.Status.ShouldBe(TransactionResultStatus.Mined); | ||
StringType.From(txResult.ReturnValue.ToByteArray()).ToString().ShouldBe("Hello"); | ||
} | ||
|
||
[Fact(Skip = "Not support selfdestruct yet.")] | ||
public async Task SelfterminateTest() | ||
{ | ||
var contractAddress = await DeployContractAsync(); | ||
var txResult = await ExecuteTransactionAsync(contractAddress, "selfterminate"); | ||
txResult.Status.ShouldBe(TransactionResultStatus.Mined); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
test/AElf.Contracts.SolidityContract.Tests/ContractTests/MyTokenTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Threading.Tasks; | ||
using Scale; | ||
using Shouldly; | ||
using Xunit.Abstractions; | ||
|
||
namespace AElf.Contracts.SolidityContract; | ||
|
||
public class MyTokenTests : SolidityContractTestBase | ||
{ | ||
private readonly ITestOutputHelper _outputHelper; | ||
|
||
public MyTokenTests(ITestOutputHelper outputHelper) : base(outputHelper) | ||
{ | ||
_outputHelper = outputHelper; | ||
ContractPath = "contracts/mytoken.contract"; | ||
} | ||
|
||
[Fact] | ||
public async Task MyTokenTest() | ||
{ | ||
var contractAddress = await DeployContractAsync(); | ||
|
||
{ | ||
var txResult = await ExecuteTransactionAsync(contractAddress, "test", | ||
TupleType<AddressType, BoolType>.GetByteStringFrom( | ||
AddressType.From(DefaultSender.ToByteArray()), | ||
BoolType.From(true) | ||
)); | ||
|
||
AddressType.From(txResult.ReturnValue.ToByteArray()).Value.ShouldBe(DefaultSender); | ||
} | ||
|
||
{ | ||
var txResult = await ExecuteTransactionAsync(contractAddress, "test", | ||
TupleType<AddressType, BoolType>.GetByteStringFrom( | ||
AddressType.From(DefaultSender.ToByteArray()), | ||
BoolType.From(false) | ||
)); | ||
|
||
AddressType.From(txResult.ReturnValue.ToByteArray()).Value.ShouldBe(DefaultSender); | ||
} | ||
} | ||
} |
299 changes: 299 additions & 0 deletions
299
test/AElf.Contracts.SolidityContract.Tests/contracts/destruct.contract
Large diffs are not rendered by default.
Oops, something went wrong.
309 changes: 309 additions & 0 deletions
309
test/AElf.Contracts.SolidityContract.Tests/contracts/mytoken.contract
Large diffs are not rendered by default.
Oops, something went wrong.