コード例 #1
0
        public async Task <string> Handle(CalculateInterestCommand request, CancellationToken cancellationToken)
        {
            var interest = await _interestTaxClienthttp.GetInterestTaxAsync();

            if (string.IsNullOrWhiteSpace(interest))
            {
                _notification.RaiseError("Não foi possível obter a taxa de juros.");
                return(default);
コード例 #2
0
        public async Task Should_Calculate_Interest(double initialValue, int months, string expectedResult)
        {
            _http.GetInterestTaxAsync().ReturnsForAnyArgs(x =>
            {
                return(Task.FromResult("0.01"));
            });

            var calculateInterestCommand = new CalculateInterestCommand(initialValue, months);

            var result = await new CalculateInterestHandler(_http, _notification, _configuration).Handle(calculateInterestCommand, new CancellationToken());

            Assert.True(result == expectedResult);
            Assert.True(!_notification.HasNotifications());
        }