forked from Beans-BV/dotnet-stellar-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added serialisation/deserialisation for Soroban operations and smart …
…contract value types Co-authored-by: Jop Middelkamp <[email protected]>
- Loading branch information
1 parent
5c09de2
commit 5e18722
Showing
386 changed files
with
25,095 additions
and
12,351 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
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,51 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using stellar_dotnet_sdk; | ||
|
||
namespace stellar_dotnet_sdk_test; | ||
|
||
[TestClass] | ||
public class AddressTest | ||
{ | ||
[TestMethod] | ||
public void TestAccountIdWithInvalidArgument() | ||
{ | ||
const string invalidAccountId = "Invalidid"; | ||
var ex = Assert.ThrowsException<ArgumentException>(() => new SCAccountId(invalidAccountId)); | ||
Assert.AreEqual("Invalid account id (Parameter 'value')", ex.Message); | ||
} | ||
|
||
[TestMethod] | ||
public void TestContractIdWithInvalidArgument() | ||
{ | ||
const string invalidContractId = "Invalidid"; | ||
var ex = Assert.ThrowsException<ArgumentException>(() => new SCContractId(invalidContractId)); | ||
Assert.AreEqual("Invalid contract id (Parameter 'value')", ex.Message); | ||
} | ||
|
||
[TestMethod] | ||
public void TestAccountIdWithValidArgument() | ||
{ | ||
var scAccountId = new SCAccountId("GCZFMH32MF5EAWETZTKF3ZV5SEVJPI53UEMDNSW55WBR75GMZJU4U573"); | ||
|
||
// Act | ||
var scAccountIdXdrBase64 = scAccountId.ToXdrBase64(); | ||
var fromXdrBase64ScAccountId = (SCAccountId)SCVal.FromXdrBase64(scAccountIdXdrBase64); | ||
|
||
// Assert | ||
Assert.AreEqual(scAccountId.InnerValue, fromXdrBase64ScAccountId.InnerValue); | ||
} | ||
|
||
[TestMethod] | ||
public void TestContractIdWithValidArgument() | ||
{ | ||
var scContractId = new SCContractId("CAC2UYJQMC4ISUZ5REYB2AMDC44YKBNZWG4JB6N6GBL66CEKQO3RDSAB"); | ||
|
||
// Act | ||
var scContractIdXdrBase64 = scContractId.ToXdrBase64(); | ||
var fromXdrBase64ScContractId = (SCContractId)SCVal.FromXdrBase64(scContractIdXdrBase64); | ||
|
||
// Assert | ||
Assert.AreEqual(scContractId.InnerValue, fromXdrBase64ScContractId.InnerValue); | ||
} | ||
} |
Oops, something went wrong.