コード例 #1
0
        public void SetUp()
        {
            _mockCommitmentRespository = new Mock <ICommitmentRepository>();
            _handler = new GetCommitmentQueryHandler(_mockCommitmentRespository.Object, new GetCommitmentValidator(), new CommitmentRules());

            Fixture dataFixture = new Fixture();

            _fakeRepositoryCommitment = dataFixture.Build <Commitment>().Create();
            _exampleValidRequest      = new GetCommitmentRequest
            {
                CommitmentId = _fakeRepositoryCommitment.Id,
                Caller       = new Caller
                {
                    CallerType = CallerType.Provider,
                    Id         = _fakeRepositoryCommitment.ProviderId.Value
                }
            };
        }
        public void SetUp()
        {
            _mockCommitmentRespository = new Mock <ICommitmentRepository>();
            _handler = new GetCommitmentQueryHandler(_mockCommitmentRespository.Object, new GetCommitmentValidator(),
                                                     new CommitmentRules());

            var dataFixture = new Fixture();

            _fakeCommitment      = dataFixture.Build <Commitment>().Create();
            _exampleValidRequest = new GetCommitmentRequest
            {
                CommitmentId = _fakeCommitment.Id,
                Caller       = new Caller
                {
                    CallerType = CallerType.TransferSender,
                    Id         = (long)_fakeCommitment?.TransferSenderId.Value
                }
            };
            _mockCommitmentRespository.Setup(x => x.GetCommitmentById(It.IsAny <long>())).ReturnsAsync(_fakeCommitment);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            GetCommitmentRequest request;

            try
            {
                request = new GetCommitmentRequest
                {
                    CommitmentId = CommitmentId,
                    OpcRequestId = OpcRequestId,
                    XOneGatewaySubscriptionId = XOneGatewaySubscriptionId,
                    XOneOriginRegion          = XOneOriginRegion
                };

                response = client.GetCommitment(request).GetAwaiter().GetResult();
                WriteOutput(response, response.CommitmentDetail);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }