public void PaybacFactory_Should_Create_Steady() { var paybackStrategy = PaybackFactory.Build(PaybackType.Steady, 10); paybackStrategy.Should().NotBeNull(); paybackStrategy.Should().BeOfType <SteadyPaybackStrategy>(); }
public async Task <IActionResult> Get(decimal amount, int years, int paybackType) { try { var paybackStrategy = PaybackFactory.Build((PaybackType)paybackType, years); var loanCost = await _calculationService.GetLoanPaybackPlan( new HouseLoan { Amount = amount, Years = years, PaybackStrategy = paybackStrategy }); return(Ok(loanCost)); } catch (Exception m) { return(StatusCode((int)HttpStatusCode.InternalServerError, m.Message)); } }
public void PaybacFactory_Should_Throw_Exception() { Action test = () => PaybackFactory.Build((PaybackType)1000, 10); test.Should().Throw <NotImplementedException>().WithMessage($"1000 is not implemented as payback strategy."); }