コード例 #1
0
        public async Task <bool> Send([ActivityTrigger] AccountLegalEntityCollectionPeriod accountLegalEntityCollectionPeriod)
        {
            var collectionPeriod     = accountLegalEntityCollectionPeriod.CollectionPeriod;
            var accountLegalEntityId = accountLegalEntityCollectionPeriod.AccountLegalEntityId;

            _logger.LogInformation("[SendPaymentRequestsForAccountLegalEntity] Publish SendPaymentRequestsCommand for account legal entity {accountLegalEntityId}, collection period {collectionPeriod}", accountLegalEntityId, collectionPeriod);
            await _commandDispatcher.Send(new SendPaymentRequestsCommand(accountLegalEntityId, DateTime.UtcNow));

            _logger.LogInformation("[SendPaymentRequestsForAccountLegalEntity] Published SendPaymentRequestsCommand for account legal entity {accountLegalEntityId}, collection period {collectionPeriod}", accountLegalEntityId, collectionPeriod);
            return(true);
        }
        public void Setup()
        {
            _fixture = new Fixture();
            _accountLegalEntityCollectionPeriod = _fixture.Create <AccountLegalEntityCollectionPeriod>();
            _pendingPayments     = _fixture.CreateMany <PendingPaymentDto>(3).ToList();
            _mockQueryDispatcher = new Mock <IQueryDispatcher>();
            _mockQueryDispatcher
            .Setup(x =>
                   x.Send <GetPendingPaymentsForAccountLegalEntityRequest, GetPendingPaymentsForAccountLegalEntityResponse>(
                       It.IsAny <GetPendingPaymentsForAccountLegalEntityRequest>()))
            .ReturnsAsync(new GetPendingPaymentsForAccountLegalEntityResponse(_pendingPayments));

            _sut = new GetPendingPaymentsForAccountLegalEntity(_mockQueryDispatcher.Object, Mock.Of <ILogger <GetPendingPaymentsForAccountLegalEntity> >());
        }
        public void Setup()
        {
            // Arrange
            _fixture = new Fixture();
            var collectionPeriod     = _fixture.Create <CollectionPeriod>();
            var accountLegalEntityId = _fixture.Create <long>();

            _accountLegalEntityCollectionPeriod = new AccountLegalEntityCollectionPeriod {
                AccountLegalEntityId = accountLegalEntityId, CollectionPeriod = collectionPeriod
            };
            _mockOrchestrationContext = new Mock <IDurableOrchestrationContext>();
            _mockOrchestrationContext.Setup(x => x.GetInput <AccountLegalEntityCollectionPeriod>()).Returns(_accountLegalEntityCollectionPeriod);

            _pendingPayments = _fixture.CreateMany <PendingPaymentActivityDto>(3).ToList();
            _mockOrchestrationContext.Setup(x => x.CallActivityAsync <List <PendingPaymentActivityDto> >("GetPendingPaymentsForAccountLegalEntity", _accountLegalEntityCollectionPeriod)).ReturnsAsync(_pendingPayments);

            _orchestrator = new CalculatePaymentsForAccountLegalEntityOrchestrator();
        }