Exemplo n.º 1
0
        public CredentialTests()
        {
            var recordService = new DefaultWalletRecordService();
            var ledgerService = new DefaultLedgerService();

            _eventAggregator = new EventAggregator();

            var provisioning = ServiceUtils.GetDefaultMockProvisioningService();

            var tailsService = new DefaultTailsService(ledgerService, new HttpClientHandler());

            _schemaService = new DefaultSchemaService(provisioning, recordService, ledgerService, tailsService);

            _connectionService = new DefaultConnectionService(
                _eventAggregator,
                recordService,
                provisioning,
                new Mock <ILogger <DefaultConnectionService> >().Object);

            _credentialService = new DefaultCredentialService(
                _eventAggregator,
                ledgerService,
                _connectionService,
                recordService,
                _schemaService,
                tailsService,
                provisioning,
                new Mock <ILogger <DefaultCredentialService> >().Object);
        }
Exemplo n.º 2
0
        public CredentialTests()
        {
            var recordService = new DefaultWalletRecordService();
            var ledgerService = new DefaultLedgerService();

            _eventAggregator = new EventAggregator();
            _poolService     = new DefaultPoolService();

            var routingMock = new Mock <IMessageService>();

            routingMock.Setup(x =>
                              x.SendAsync(It.IsAny <Wallet>(), It.IsAny <IAgentMessage>(), It.IsAny <ConnectionRecord>(), It.IsAny <string>()))
            .Callback((Wallet _, IAgentMessage content, ConnectionRecord __, string ___) =>
            {
                if (_routeMessage)
                {
                    _messages.Add(content);
                }
                else
                {
                    throw new AgentFrameworkException(ErrorCode.LedgerOperationRejected, "");
                }
            })
            .Returns(Task.FromResult(false));

            var provisioningMock = new Mock <IProvisioningService>();

            provisioningMock.Setup(x => x.GetProvisioningAsync(It.IsAny <Wallet>()))
            .Returns(Task.FromResult(new ProvisioningRecord
            {
                Endpoint = new AgentEndpoint {
                    Uri = MockEndpointUri
                },
                MasterSecretId = MasterSecretId,
                TailsBaseUri   = MockEndpointUri
            }));

            var tailsService = new DefaultTailsService(ledgerService);

            _schemaService = new DefaultSchemaService(provisioningMock.Object, recordService, ledgerService, tailsService);

            _connectionService = new DefaultConnectionService(
                _eventAggregator,
                recordService,
                routingMock.Object,
                provisioningMock.Object,
                new Mock <ILogger <DefaultConnectionService> >().Object);

            _credentialService = new DefaultCredentialService(
                _eventAggregator,
                routingMock.Object,
                ledgerService,
                _connectionService,
                recordService,
                _schemaService,
                tailsService,
                provisioningMock.Object,
                new Mock <ILogger <DefaultCredentialService> >().Object);
        }
        public DidExchangeTests()
        {
            IEventAggregator eventAggregator = new EventAggregator();
            var provisioningService          = ServiceUtils.GetDefaultMockProvisioningService();
            var ledgerService = new DefaultLedgerService(new Mock <ILedgerSigningService>().Object);

            _didExchangeService = new DefaultDidExchangeService(ledgerService, new Mock <IWalletRecordService>().Object,
                                                                provisioningService, eventAggregator);
        }
Exemplo n.º 4
0
        public SchemaServiceTests()
        {
            var walletService = new DefaultWalletRecordService();
            var ledgerService = new DefaultLedgerService();
            var tailsService  = new DefaultTailsService(ledgerService);

            _poolService   = new DefaultPoolService();
            _schemaService = new DefaultSchemaService(walletService, ledgerService, tailsService);
        }
        public EphemeralChallengeTests()
        {
            var recordService = new DefaultWalletRecordService();
            var ledgerService = new DefaultLedgerService();

            var eventAggregator = new EventAggregator();

            var routingMock = new Mock <IMessageService>();

            routingMock.Setup(x =>
                              x.SendAsync(It.IsAny <Wallet>(), It.IsAny <AgentMessage>(), It.IsAny <ConnectionRecord>(), It.IsAny <string>(), It.IsAny <bool>()))
            .Callback((Wallet _, AgentMessage content, ConnectionRecord __, string ___, bool ____) =>
            {
                if (_routeMessage)
                {
                    _messages.Add(content);
                }
                else
                {
                    throw new AgentFrameworkException(ErrorCode.LedgerOperationRejected, "");
                }
            })
            .Returns(Task.FromResult <MessageContext>(null));

            var provisioningMock = ServiceUtils.GetDefaultMockProvisioningService();

            var tailsService = new DefaultTailsService(ledgerService, new HttpClientHandler());

            _schemaService = new DefaultSchemaService(provisioningMock, recordService, ledgerService, tailsService);

            _connectionService = new DefaultConnectionService(
                eventAggregator,
                recordService,
                provisioningMock,
                new Mock <ILogger <DefaultConnectionService> >().Object);

            _credentialService = new DefaultCredentialService(
                eventAggregator,
                ledgerService,
                _connectionService,
                recordService,
                _schemaService,
                tailsService,
                provisioningMock,
                new Mock <ILogger <DefaultCredentialService> >().Object);

            _proofService = new DefaultProofService(
                eventAggregator,
                _connectionService,
                recordService,
                provisioningMock,
                ledgerService,
                tailsService,
                new Mock <ILogger <DefaultProofService> >().Object);

            _ephemeralChallengeService = new DefaultEphemeralChallengeService(eventAggregator, _proofService, recordService, provisioningMock, new Mock <ILogger <DefaultEphemeralChallengeService> >().Object);
        }
Exemplo n.º 6
0
        public SchemaServiceTests()
        {
            var walletService = new DefaultWalletRecordService();
            var ledgerService = new DefaultLedgerService();
            var tailsService  = new DefaultTailsService(ledgerService, new HttpClientHandler());

            var provisioningMock = new Mock <IProvisioningService>();

            _schemaService = new DefaultSchemaService(provisioningMock.Object, walletService, ledgerService, tailsService);
        }
Exemplo n.º 7
0
        public ProofTests()
        {
            var recordService = new DefaultWalletRecordService();
            var ledgerService = new DefaultLedgerService(new DefaultLedgerSigningService());

            _eventAggregator = new EventAggregator();

            var messageService = new DefaultMessageService(new Mock <ILogger <DefaultMessageService> >().Object, new IMessageDispatcher[] { });

            var provisioning   = ServiceUtils.GetDefaultMockProvisioningService();
            var paymentService = new DefaultPaymentService();

            var clientFactory = new Mock <IHttpClientFactory>();

            clientFactory.Setup(x => x.CreateClient(It.IsAny <string>()))
            .Returns(new HttpClient());

            var tailsService = new DefaultTailsService(ledgerService, clientFactory.Object);

            _schemaService = new DefaultSchemaService(provisioning, recordService, ledgerService, paymentService, tailsService);

            _connectionService = new DefaultConnectionService(
                _eventAggregator,
                recordService,
                provisioning,
                new Mock <ILogger <DefaultConnectionService> >().Object);

            _credentialService = new DefaultCredentialService(
                _eventAggregator,
                ledgerService,
                _connectionService,
                recordService,
                _schemaService,
                tailsService,
                provisioning,
                paymentService,
                messageService,
                new Mock <ILogger <DefaultCredentialService> >().Object);

            _proofService = new DefaultProofService(
                _eventAggregator,
                _connectionService,
                recordService,
                provisioning,
                ledgerService,
                tailsService,
                messageService,
                new Mock <ILogger <DefaultProofService> >().Object);
        }
Exemplo n.º 8
0
        public CredentialTests()
        {
            var messageSerializer = new DefaultMessageSerializer();
            var recordService     = new DefaultWalletRecordService();
            var ledgerService     = new DefaultLedgerService();

            _poolService = new DefaultPoolService();

            var routingMock = new Mock <IRouterService>();

            routingMock.Setup(x => x.ForwardAsync(It.IsNotNull <IEnvelopeMessage>(), It.IsAny <AgentEndpoint>()))
            .Callback((IEnvelopeMessage content, AgentEndpoint endpoint) => { _messages.Add(content); })
            .Returns(Task.CompletedTask);

            var provisioningMock = new Mock <IProvisioningService>();

            provisioningMock.Setup(x => x.GetProvisioningAsync(It.IsAny <Wallet>()))
            .Returns(Task.FromResult(new ProvisioningRecord
            {
                Endpoint = new AgentEndpoint {
                    Uri = MockEndpointUri
                },
                MasterSecretId = MasterSecretId,
                TailsBaseUri   = MockEndpointUri
            }));

            var tailsService = new DefaultTailsService(ledgerService);

            _schemaService = new DefaultSchemaService(recordService, ledgerService, tailsService);

            _connectionService = new DefaultConnectionService(
                recordService,
                routingMock.Object,
                provisioningMock.Object,
                messageSerializer,
                new Mock <ILogger <DefaultConnectionService> >().Object);

            _credentialService = new DefaultCredentialService(
                routingMock.Object,
                ledgerService,
                _connectionService,
                recordService,
                messageSerializer,
                _schemaService,
                tailsService,
                provisioningMock.Object,
                new Mock <ILogger <DefaultCredentialService> >().Object);
        }