public RoutingInboxHandlerTests() { recordService = new Mock <IWalletRecordService>(); walletService = new Mock <IWalletService>(); routingStore = new Mock <IRoutingStore>(); agentContext = new Mock <IAgentContext>(); IOptions <AgentOptions> ooptions = Options.Create <AgentOptions>(new AgentOptions()); logger = new Mock <ILogger <RoutingInboxHandler> >(); routingInboxHandler = new RoutingInboxHandler(recordService.Object, walletService.Object, routingStore.Object, ooptions, logger.Object); }
public async Task CreateInboxRecordWithStorageConfigurationAndCredentialsAsync() { string keyDerivationMethod = "RAW"; object storageCredentials = new {}; WalletConfiguration.WalletStorageConfiguration storageConfiguration = new WalletConfiguration.WalletStorageConfiguration(); string storageType = "postgres_storage"; IOptions <AgentOptions> options = Options.Create <AgentOptions>(new AgentOptions() { WalletConfiguration = new WalletConfiguration() { StorageType = storageType, StorageConfiguration = storageConfiguration }, WalletCredentials = new WalletCredentials() { KeyDerivationMethod = keyDerivationMethod, StorageCredentials = storageCredentials } }); UnpackedMessageContext unpackedMessage = new UnpackedMessageContext( new CreateInboxMessage(), new ConnectionRecord() { State = ConnectionState.Connected, }); routingInboxHandler = new RoutingInboxHandler(recordService.Object, walletService.Object, routingStore.Object, options, logger.Object); CreateInboxResponseMessage agentMessage = (CreateInboxResponseMessage)await routingInboxHandler.ProcessAsync(agentContext.Object, unpackedMessage); walletService.Verify(w => w.CreateWalletAsync(It.Is <WalletConfiguration>(wc => wc.Id == agentMessage.InboxId && wc.StorageConfiguration == storageConfiguration && wc.StorageType == storageType ), It.Is <WalletCredentials>(wc => wc.Key == agentMessage.InboxKey && wc.KeyDerivationMethod == keyDerivationMethod && wc.StorageCredentials == storageCredentials ))); }