public async Task <ActionResult> Send(SendTransferConnectionInvitationQuery query)
        {
            var response = await _mediator.SendAsync(query);

            var model = _mapper.Map <SendTransferConnectionInvitationViewModel>(response);

            return(View(model));
        }
コード例 #2
0
        public void Arrange()
        {
            _db = new Mock <EmployerAccountsDbContext>();

            _receiverAccount = new Account
            {
                Id             = 111111,
                PublicHashedId = "ABC123"
            };

            _senderAccount = new Account
            {
                Id             = 222222,
                PublicHashedId = "XYZ987"
            };

            _accounts = new List <Account> {
                _receiverAccount, _senderAccount
            };
            _accountsDbSet = new DbSetStub <Account>(_accounts);
            _transferConnectionInvitations      = new List <TransferConnectionInvitation>();
            _transferConnectionInvitationsDbSet = new DbSetStub <TransferConnectionInvitation>(_transferConnectionInvitations);
            _configurationProvider = new MapperConfiguration(c => c.AddProfile <AccountMappings>());
            _publicHashingService  = new Mock <IPublicHashingService>();

            _db.Setup(d => d.Accounts).Returns(_accountsDbSet);
            _db.Setup(d => d.TransferConnectionInvitations).Returns(_transferConnectionInvitationsDbSet);
            _publicHashingService.Setup(h => h.DecodeValue(_receiverAccount.PublicHashedId)).Returns(_receiverAccount.Id);

            var outParam = _receiverAccount.Id;

            _publicHashingService.Setup(
                h => h.TryDecodeValue(
                    _receiverAccount.PublicHashedId,
                    out outParam))
            .Returns(true);

            _handler = new SendTransferConnectionInvitationQueryHandler(new Lazy <EmployerAccountsDbContext>(() => _db.Object), _configurationProvider, _publicHashingService.Object);

            _query = new SendTransferConnectionInvitationQuery
            {
                AccountId = _senderAccount.Id,
                ReceiverAccountPublicHashedId = _receiverAccount.PublicHashedId
            };
        }