This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from srottem/feature/dotnet_test_fixes
Feature/dotnet test fixes
- Loading branch information
Showing
48 changed files
with
728 additions
and
771 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
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
19 changes: 10 additions & 9 deletions
19
wrappers/dotnet/indy-sdk-dotnet-test/Wrapper/AgentTests/AgentAddIdentityTest.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
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
51 changes: 26 additions & 25 deletions
51
wrappers/dotnet/indy-sdk-dotnet-test/Wrapper/AgentTests/AgentConnectTest.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 |
---|---|---|
@@ -1,72 +1,73 @@ | ||
using Indy.Sdk.Dotnet.Wrapper; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Threading.Tasks; | ||
|
||
namespace Indy.Sdk.Dotnet.Test.Wrapper.AgentTests | ||
{ | ||
[TestClass] | ||
public class AgentConnectTest : AgentIntegrationTestBase | ||
{ | ||
[TestMethod] | ||
public void TestAgentConnectWorksForRemoteData() | ||
public async Task TestAgentConnectWorksForRemoteData() | ||
{ | ||
var endpoint = "127.0.0.1:9605"; | ||
var listenerWalletName = "listenerWallet"; | ||
var trusteeWalletName = "trusteeWallet"; | ||
|
||
Wallet.CreateWalletAsync(_poolName, listenerWalletName, "default", null, null).Wait(); | ||
var listenerWallet = Wallet.OpenWalletAsync(listenerWalletName, null, null).Result; | ||
await Wallet.CreateWalletAsync(_poolName, listenerWalletName, "default", null, null); | ||
var listenerWallet = await Wallet.OpenWalletAsync(listenerWalletName, null, null); | ||
|
||
Wallet.CreateWalletAsync(_poolName, trusteeWalletName, "default", null, null).Wait(); | ||
var trusteeWallet = Wallet.OpenWalletAsync(trusteeWalletName, null, null).Result; | ||
await Wallet.CreateWalletAsync(_poolName, trusteeWalletName, "default", null, null); | ||
var trusteeWallet = await Wallet.OpenWalletAsync(trusteeWalletName, null, null); | ||
var senderWallet = trusteeWallet; | ||
|
||
var createMyDidResult = Signus.CreateAndStoreMyDidAsync(listenerWallet, "{}").Result; | ||
var createMyDidResult = await Signus.CreateAndStoreMyDidAsync(listenerWallet, "{}"); | ||
var listenerDid = createMyDidResult.Did; | ||
var listenerVerkey = createMyDidResult.VerKey; | ||
var listenerPk = createMyDidResult.Pk; | ||
|
||
var trusteeDidJson = "{\"seed\":\"000000000000000000000000Trustee1\"}"; | ||
|
||
var trusteeDidResult = Signus.CreateAndStoreMyDidAsync(trusteeWallet, trusteeDidJson).Result; | ||
var trusteeDidResult = await Signus.CreateAndStoreMyDidAsync(trusteeWallet, trusteeDidJson); | ||
var trusteeDid = trusteeDidResult.Did; | ||
var senderDid = trusteeDid; | ||
|
||
var nymRequest = Ledger.BuildNymRequestAsync(trusteeDid, listenerDid, listenerVerkey, null, null).Result; | ||
Ledger.SignAndSubmitRequestAsync(_pool, trusteeWallet, trusteeDid, nymRequest).Wait(); | ||
var nymRequest = await Ledger.BuildNymRequestAsync(trusteeDid, listenerDid, listenerVerkey, null, null); | ||
await Ledger.SignAndSubmitRequestAsync(_pool, trusteeWallet, trusteeDid, nymRequest); | ||
|
||
var attribRequest = Ledger.BuildAttribRequestAsync(listenerDid, listenerDid, null, | ||
string.Format("{{\"endpoint\":{{\"ha\":\"{0}\",\"verkey\":\"{1}\"}}}}", endpoint, listenerPk), null).Result; | ||
Ledger.SignAndSubmitRequestAsync(_pool, listenerWallet, listenerDid, attribRequest).Wait(); | ||
var attribRequest = await Ledger.BuildAttribRequestAsync(listenerDid, listenerDid, null, | ||
string.Format("{{\"endpoint\":{{\"ha\":\"{0}\",\"verkey\":\"{1}\"}}}}", endpoint, listenerPk), null); | ||
await Ledger.SignAndSubmitRequestAsync(_pool, listenerWallet, listenerDid, attribRequest); | ||
|
||
var activeListener = Agent.AgentListenAsync(endpoint, _incomingConnectionObserver).Result; | ||
var activeListener = await Agent.AgentListenAsync(endpoint, _incomingConnectionObserver); | ||
|
||
activeListener.AddIdentityAsync(_pool, listenerWallet, listenerDid).Wait(); | ||
await activeListener.AddIdentityAsync(_pool, listenerWallet, listenerDid); | ||
|
||
Agent.AgentConnectAsync(_pool, senderWallet, senderDid, listenerDid, _messageObserver).Wait(); | ||
await Agent.AgentConnectAsync(_pool, senderWallet, senderDid, listenerDid, _messageObserver); | ||
|
||
listenerWallet.CloseAsync().Wait(); | ||
Wallet.DeleteWalletAsync(listenerWalletName, null).Wait(); | ||
await listenerWallet.CloseAsync(); | ||
await Wallet.DeleteWalletAsync(listenerWalletName, null); | ||
|
||
trusteeWallet.CloseAsync().Wait(); | ||
Wallet.DeleteWalletAsync(trusteeWalletName, null).Wait(); | ||
await trusteeWallet.CloseAsync(); | ||
await Wallet.DeleteWalletAsync(trusteeWalletName, null); | ||
} | ||
|
||
[TestMethod] | ||
public void TestAgentConnectWorksForAllDataInWalletPresent() | ||
public async Task TestAgentConnectWorksForAllDataInWalletPresent() | ||
{ | ||
var endpoint = "127.0.0.1:9606"; | ||
|
||
var myDidResult = Signus.CreateAndStoreMyDidAsync(_wallet, "{}").Result; | ||
var myDidResult = await Signus.CreateAndStoreMyDidAsync(_wallet, "{}"); | ||
|
||
var identityJson = string.Format("{{\"did\":\"{0}\", \"pk\":\"{1}\", \"verkey\":\"{2}\", \"endpoint\":\"{3}\"}}", | ||
myDidResult.Did, myDidResult.Pk, myDidResult.VerKey, endpoint); | ||
Signus.StoreTheirDidAsync(_wallet, identityJson).Wait(); | ||
await Signus.StoreTheirDidAsync(_wallet, identityJson); | ||
|
||
var activeListener = Agent.AgentListenAsync(endpoint, _incomingConnectionObserver).Result; | ||
var activeListener = await Agent.AgentListenAsync(endpoint, _incomingConnectionObserver); | ||
|
||
activeListener.AddIdentityAsync(_pool, _wallet, myDidResult.Did).Wait(); | ||
await activeListener.AddIdentityAsync(_pool, _wallet, myDidResult.Did); | ||
|
||
Agent.AgentConnectAsync(_pool, _wallet, myDidResult.Did, myDidResult.Did, _messageObserver).Wait(); | ||
await Agent.AgentConnectAsync(_pool, _wallet, myDidResult.Did, myDidResult.Did, _messageObserver); | ||
} | ||
} | ||
} |
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
9 changes: 5 additions & 4 deletions
9
wrappers/dotnet/indy-sdk-dotnet-test/Wrapper/AgentTests/AgentListenTest.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 |
---|---|---|
@@ -1,25 +1,26 @@ | ||
using Indy.Sdk.Dotnet.Wrapper; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Threading.Tasks; | ||
|
||
namespace Indy.Sdk.Dotnet.Test.Wrapper.AgentTests | ||
{ | ||
[TestClass] | ||
public class AgentListenTest : AgentIntegrationTestBase | ||
{ | ||
[TestMethod] | ||
public void TestAgentListenWorks() | ||
public async Task TestAgentListenWorks() | ||
{ | ||
var endpoint = "127.0.0.1:9607"; | ||
|
||
var didJson = "{\"seed\":\"sovrin_agent_connect_works_for_a\"}"; | ||
|
||
var myDidResult = Signus.CreateAndStoreMyDidAsync(_wallet, didJson).Result; | ||
var myDidResult = await Signus.CreateAndStoreMyDidAsync(_wallet, didJson); | ||
|
||
var identityJson = string.Format("{{\"did\":\"{0}\", \"pk\":\"{1}\", \"verkey\":\"{2}\", \"endpoint\":\"{3}\"}}", | ||
myDidResult.Did, myDidResult.Pk, myDidResult.VerKey, endpoint); | ||
Signus.StoreTheirDidAsync(_wallet, identityJson).Wait(); | ||
await Signus.StoreTheirDidAsync(_wallet, identityJson); | ||
|
||
Agent.AgentListenAsync(endpoint, _incomingConnectionObserver).Wait(); | ||
await Agent.AgentListenAsync(endpoint, _incomingConnectionObserver); | ||
} | ||
} | ||
} |
Oops, something went wrong.