-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add exodus transaction getter and setter
- Loading branch information
thebevrishot
committed
Nov 20, 2019
1 parent
d31b625
commit 717f5ce
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/Ztm.Zcoin.NBitcoin.Tests/TransactionExtensionsTests.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,46 @@ | ||
using NBitcoin; | ||
using Xunit; | ||
using Ztm.Zcoin.NBitcoin.Exodus; | ||
|
||
namespace Ztm.Zcoin.NBitcoin.Tests | ||
{ | ||
public sealed class TransactionExtensionsTests | ||
{ | ||
readonly Transaction subject; | ||
|
||
public TransactionExtensionsTests() | ||
{ | ||
this.subject = Transaction.Parse(ZcoinTransactionData.ZerocoinRemint, ZcoinNetworks.Instance.Regtest); | ||
} | ||
|
||
[Fact] | ||
public void SetExodusTransaction_WithNull_ShouldNotThrow() | ||
{ | ||
this.subject.SetExodusTransaction(null); | ||
} | ||
|
||
[Fact] | ||
public void GetExodusTransaction_WithUnsetValue_ShouldRetreiveNull() | ||
{ | ||
Assert.Null(this.subject.GetExodusTransaction()); | ||
} | ||
|
||
[Fact] | ||
public void SetAndGetExodusTransaction_WithValidTransaction_ShouldRetreiveSameTx() | ||
{ | ||
// Arrange. | ||
var address = BitcoinAddress.Create("TG3Pnw5xPZQS8JXMVa3F9WjUFfUqXKsqAz", ZcoinNetworks.Instance.Regtest); | ||
var propertyId = new PropertyId(3); | ||
var amount = new PropertyAmount(10); | ||
|
||
var exodusTx = new SimpleSendV0(address, address, propertyId, amount); | ||
|
||
// Act. | ||
this.subject.SetExodusTransaction(exodusTx); | ||
var retrieved = this.subject.GetExodusTransaction(); | ||
|
||
// Assert. | ||
Assert.Same(exodusTx, retrieved); | ||
} | ||
} | ||
} |
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