Exemplo n.º 1
0
 public QuoteService(ILogger <QuoteService> logger, IConfiguration configuration,
                     ILenderService lenderService, IRepaymentService repaymentService, IConditionService conditionService)
 {
     _logger                = logger;
     _lenderService         = lenderService;
     _repaymentService      = repaymentService;
     _conditionService      = conditionService;
     _repaymentLengthMonths = configuration.GetValue <int>("RepaymentLengthMonths");
 }
Exemplo n.º 2
0
        public void GetMonthlyRepaymentAmount_CalculateAmount_ReturnValidAmount(int amountRequested, double interestRateDecimal,
                                                                                int repaymentLengthMonths, double expectedResult)
        {
            #region Arrange

            _repaymentService = new RepaymentService(_logger.Object);

            #endregion

            #region Act

            var result = _repaymentService.GetMonthlyRepaymentAmount(amountRequested, interestRateDecimal, repaymentLengthMonths);

            #endregion

            #region Assert

            Assert.That(result, Is.EqualTo(expectedResult));

            #endregion
        }
Exemplo n.º 3
0
 public RepaymentController(IRepaymentService repaymentService)
 {
     _repaymentService = repaymentService;
 }
Exemplo n.º 4
0
 public RepaymentPresenter(IRepaymentView view, IRepaymentService repaymentService, ITranslationService translationService)
 {
     _view               = view;
     _repaymentService   = repaymentService;
     _translationService = translationService;
 }
Exemplo n.º 5
0
 public RepaymentPresenter(IRepaymentView view, IRepaymentService repaymentService, ITranslationService translationService)
 {
     _view = view;
     _repaymentService = repaymentService;
     _translationService = translationService;
 }
Exemplo n.º 6
0
 RepaymantController()
 {
     // Replace this with IoC
     // Can Use TinyIoc, Unity, Ninject, Autofac etc
     paymentService = new RepaymentService();
 }
Exemplo n.º 7
0
 public void TearDown() => _repaymentService = null;
Exemplo n.º 8
0
 public ShowRepaymentViewCommand(IRepaymentPresenter presenter, IRepaymentService service, IApplicationController appController)
 {
     _presenter     = presenter;
     _service       = service;
     _appController = appController;
 }
Exemplo n.º 9
0
 public RepaymentsController(ILogger <RepaymentsController> logger, IRepaymentService repaymentService)
 {
     _logger           = logger;
     _repaymentService = repaymentService;
 }
 RepaymantController()
 {
     // Replace this with IoC 
     // Can Use TinyIoc, Unity, Ninject, Autofac etc
     paymentService = new RepaymentService();
 }
 public void SetUp()
 {
     this.paymentService = new RepaymentService();
 }
Exemplo n.º 12
0
        public RepaymentTests()
        {
            var mockSeasons = new List <Season>
            {
                new Season {
                    Id = 1, Name = "2017 Rainy", StartDate = new DateTime(2017, 01, 01)
                },
                new Season {
                    Id = 2, Name = "2018 Rainy", StartDate = new DateTime(2018, 01, 01)
                }
            };

            var mockCustomers = new List <Customer>
            {
                new Customer {
                    Id = 1, Name = "Kit Kat"
                },
                new Customer {
                    Id = 2, Name = "Ping Pong"
                },
                new Customer {
                    Id = 3, Name = "Yin Yang"
                }
            };

            var mockCustomerSummaries = new List <CustomerSummary>
            {
                new CustomerSummary {
                    CustomerId = 1, SeasonId = 1, TotalRepaid = 200, TotalCredit = 1000
                },
                new CustomerSummary {
                    CustomerId = 1, SeasonId = 2, TotalRepaid = 700, TotalCredit = 1000
                },
                new CustomerSummary {
                    CustomerId = 2, SeasonId = 1, TotalRepaid = 1200, TotalCredit = 1000
                },
                new CustomerSummary {
                    CustomerId = 3, SeasonId = 1, TotalRepaid = 1000, TotalCredit = 1200
                },
                new CustomerSummary {
                    CustomerId = 3, SeasonId = 2, TotalRepaid = 500, TotalCredit = 500
                },
                new CustomerSummary {
                    CustomerId = 4, SeasonId = 1, TotalRepaid = 1000, TotalCredit = 1000
                },
                new CustomerSummary {
                    CustomerId = 4, SeasonId = 2, TotalRepaid = 300, TotalCredit = 100
                }
            };

            var options = new DbContextOptionsBuilder <AppDbContext>()
                          .UseInMemoryDatabase("SeasonServiceTestDb")
                          .Options;

            _dbContext = new AppDbContext(options);

            _repaymentService = new RepaymentService(_dbContext,
                                                     new BaseEntityRepository <Repayment>(_dbContext),
                                                     new CustomerSummaryRepository(_dbContext),
                                                     new BaseEntityRepository <RepaymentUpload>(_dbContext));

            _dbContext.Customers.AddRange(mockCustomers);
            _dbContext.Seasons.AddRange(mockSeasons);
            _dbContext.CustomerSummaries.AddRange(mockCustomerSummaries);
            _dbContext.SaveChanges();
        }
Exemplo n.º 13
0
 public void SetUp()
 {
     this.paymentService = new RepaymentService();
 }