public void Calculate_WhenScoreIsLowerThan500_LimitShouldZero() { //Arrange var creditParameters = new CreditParameters { Score = 400, Salary = 300 }; //Act var limit = _sut.Calculate(creditParameters); //Verify limit.Should().Be(0); }
public async Task <CreditResult> Apply(CreditApplyRequest request) { var score = await _creditScoreService.GetScore(request.IdentificationNumber); var creditParameters = new CreditParameters { Salary = request.Salary, Score = score }; var limit = _limitCalculator.Calculate(creditParameters); if (limit <= 0) { return(CreditResult.Fail()); } var credit = new Credit { IdentificationNumber = request.IdentificationNumber, Name = request.Name, Surname = request.Surname, Salary = request.Salary, TelephoneNumber = request.TelephoneNumber, CreditLimit = limit }; await _creditRepository.InsertAsync(credit); return(CreditResult.Success(limit)); }