コード例 #1
0
        public ProofRequestViewModel(IUserDialogs userDialogs,
                                     INavigationService navigationService,
                                     IProofService proofService,
                                     IAgentProvider agentContextProvider,
                                     IMessageService messageService,
                                     IConnectionService connectionService,
                                     IEventAggregator eventAggregator,
                                     IWalletRecordService recordService,
                                     IProofCredentialSelector proofCredentialSelector,
                                     ProofRecord proof) : base(AppResources.ProofRequestPageTitle, userDialogs, navigationService)
        {
            _proofRecord             = proof;
            _proofService            = proofService;
            _agentContextProvider    = agentContextProvider;
            _messageService          = messageService;
            _connectionService       = connectionService;
            _eventAggregator         = eventAggregator;
            _userDialogs             = userDialogs;
            _recordService           = recordService;
            _navigationService       = navigationService;
            _proofCredentialSelector = proofCredentialSelector;
            GetConnectionAlias();

            _proofRequest = JsonConvert.DeserializeObject <ProofRequest>(_proofRecord.RequestJson);

            ProofName = _proofRequest.Name;

            Version = _proofRequest.Version;

            State = ProofStateTranslator.Translate(_proofRecord.State);

            AreButtonsVisible = _proofRecord.State == ProofState.Requested;

            Attributes = new List <ProofAttributeViewModel>();
        }
        private async Task <SelectAttributeValueViewModel> GetSubjectAsync()
        {
            _userDialogsMock             = Substitute.For <IUserDialogs>();
            _navigationServiceMock       = Substitute.For <INavigationService>();
            _proofCredentialSelectorMock = Substitute.For <IProofCredentialSelector>();
            _proofCredentialSelectorMock.Select(Arg.Any <ProofRequest>(), Arg.Any <string>()).Returns(new List <CredentialRecord> {
                FakeData.Credentials.BirthCertificate, FakeData.Credentials.DriverLicense, FakeData.Credentials.ClubMemberCard
            });
            SelectAttributeValueViewModel subject = new SelectAttributeValueViewModel(_userDialogsMock,
                                                                                      _navigationServiceMock,
                                                                                      _proofCredentialSelectorMock,
                                                                                      GetProofRequest(),
                                                                                      "First Name",
                                                                                      (proofCredential) => _selectedProofCredential = proofCredential);
            await subject.InitializeAsync(null);

            return(subject);
        }