예제 #1
0
 public async Task <IActionResult> GetCreditScore([FromQuery] Customer customer)
 {
     try
     {
         return(StatusCode(StatusCodes.Status200OK, await Task.FromResult(_creditCalculator.CalculateCredit(customer))));
     }
     catch (Exception ex)
     {
         _logger.Log(LogLevel.Error, ex.Message);
         return(StatusCode(StatusCodes.Status500InternalServerError, "Exception Occured"));
     }
 }
예제 #2
0
        public void CalculateCredit_Returns_ValidCredit()
        {
            // Assing
            var cutomer = new Customer(750, 1, 4, 29);

            // Act
            var acutal = _sut.CalculateCredit(cutomer);

            // Assert
            acutal.Should().Be(400);
        }
        public void OverallCreditTest()
        {
            Customer john = new Customer(750, 1, 4, 29);

            Assert.AreEqual(400m, _creditCalculator.CalculateCredit(john));
        }