// ReSharper disable once InconsistentNaming public Task ICallVASPIsRegisteredAsyncMethodOfVASPIndexClient( string vaspCodeOrContractAddress, int minimalConfirmationLevel) { var vaspIndex = _scenarioContext.GetContractByType <VASPIndex>(); var vaspIndexClient = new EtherGate.VASPIndexClient(vaspIndex.RealAddress, _web3); // ReSharper disable once ConvertSwitchStatementToSwitchExpression switch (vaspCodeOrContractAddress.Length) { case 8: return(ICallVASPIsRegisteredAsyncMethodOfVASPIndexClient ( vaspIndexClient, VASPCode.Parse(vaspCodeOrContractAddress), minimalConfirmationLevel )); case 42: return(ICallVASPIsRegisteredAsyncMethodOfVASPIndexClient ( vaspIndexClient, Address.Parse(vaspCodeOrContractAddress), minimalConfirmationLevel )); default: throw new ArgumentException ( "Is definitely neither VASP code, nor VASP contract address", nameof(vaspCodeOrContractAddress) ); } }
public void GetVASPCodeAsyncCallResultShouldBe( string expectedVASPCode) { _scenarioContext .GetCallResult <VASPCode>() .ShouldBe(VASPCode.Parse(expectedVASPCode)); }
// ReSharper disable once InconsistentNaming public async Task ICallTryGetVASPContractAddressAsyncMethodOfVASPIndexClient( string vaspCode, int minimalConfirmationLevel) { var vaspIndex = _scenarioContext.GetContractByType <VASPIndex>(); var vaspIndexClient = new EtherGate.VASPIndexClient(vaspIndex.RealAddress, _web3); var callResult = await vaspIndexClient.TryGetVASPContractAddressAsync ( vaspCode : VASPCode.Parse(vaspCode), minimalConfirmationLevel : new ConfirmationLevel(minimalConfirmationLevel) ); _scenarioContext.SetCallResult(callResult); }
public async Task VASPCreatedVaspContract( string vaspCode) { var vaspIndex = _scenarioContext.GetContractByType <VASPIndex>(); var vaspContract = await vaspIndex.CreateVASPContractAsync ( vaspContractCreator : await _accounts.GetDeployerAsync(), vaspCode : VASPCode.Parse(vaspCode), vaspContractOwner : await _accounts.GetOwnerAsync(), channels : Channels.Parse("0x00000001"), transportKey : MockKeyGenerator.GenerateTransportKey(), messageKey : MockKeyGenerator.GenerateMessageKey(), signingKey : MockKeyGenerator.GenerateSigningKey() ); _scenarioContext.RegisterContract(vaspContract); }
public void SpecifiedPropertyOfTheGetVASPInfoAsyncCallResultShouldBe( string propertyName, string propertyValue) { var callResult = _scenarioContext.GetCallResult <VASPInfo>(); switch (propertyName) { case "Channels": callResult.Channels .ShouldBe(Channels.Parse(propertyValue)); break; case "MessageKey": callResult.MessageKey .ShouldBe(MessageKey.Parse(propertyValue)); break; case "SigningKey": callResult.SigningKey .ShouldBe(SigningKey.Parse(propertyValue)); break; case "TransportKey": callResult.TransportKey .ShouldBe(TransportKey.Parse(propertyValue)); break; case "VASPCode": callResult.VASPCode .ShouldBe(VASPCode.Parse(propertyValue)); break; default: throw new ArgumentException("Unexpected property name", nameof(propertyName)); } }
// ReSharper disable once InconsistentNaming public async Task ICallCreateVASPContractAsyncMethodOfVASPIndexClientWithGivenParameters() { var vaspIndex = _scenarioContext.GetContractByType <VASPIndex>(); var vaspIndexClient = new VASPIndexClient ( vaspIndex.RealAddress, _estimateGasPriceStrategy, _web3 ); var callResult = await vaspIndexClient.CreateVASPContractAsync ( from : await _accounts.GetDeployerAsync(), vaspCode : VASPCode.Parse(_scenarioContext.GetParameter("vaspCode")), owner : Address.Parse(_scenarioContext.GetParameter("owner")), channels : Channels.Parse(_scenarioContext.GetParameter("channels")), transportKey : TransportKey.Parse(_scenarioContext.GetParameter("transportKey")), messageKey : MessageKey.Parse(_scenarioContext.GetParameter("messageKey")), signingKey : SigningKey.Parse(_scenarioContext.GetParameter("signingKey")), minimalConfirmationLevel : ConfirmationLevel.Parse(_scenarioContext.GetParameter("minimalConfirmationLevel")) ); _scenarioContext.SetCallResult(callResult); }