Example #1
0
        public async Task Then_the_incentive_is_deleted_when_the_incentive_has_no_paid_earnings()
        {
            //Arrange
            var incentive = _fixture.Create <Domain.ApprenticeshipIncentives.ApprenticeshipIncentive>();

            var command = new WithdrawCommand(incentive.Account.Id, incentive.Id);

            _mockIncentiveDomainRepository.Setup(x => x.FindByApprenticeshipId(command.IncentiveApplicationApprenticeshipId)).ReturnsAsync(incentive);

            // Act
            await _sut.Handle(command);

            // Assert
            incentive.IsDeleted.Should().BeTrue();
        }
        public void Withdraw_GivenUnSupportCurrency_ShouldThrowBusinessErrorException()
        {
            var command = new WithdrawCommand()
            {
                AccountNumber = "1", Amount = 3, Currency = "VND"
            };

            var result = Assert.ThrowsAsync <WithdrawFailException>(() => handler.Handle(command, CancellationToken.None));

            result.ShouldNotBeNull();
            result.Message.Contains("Invalid Currency VND.");
        }