Beispiel #1
0
        public void CalculateBalance(decimal totalOut, decimal totalEntry, decimal expected)
        {
            var dayBalanceBusiness = new DayBalanceBusiness(_dayBalanceRepository.Object, _financialEntryValidateService.Object, _configuration.Object);
            var entiry             = new DayBalanceEntity()
            {
                TotalOut   = totalOut,
                TotalEntry = totalEntry
            };
            var result = dayBalanceBusiness.CalculateBalance(entiry);

            Assert.Equal(expected, result);
        }
Beispiel #2
0
        public void CalculateInterest(string interest, decimal balance, decimal percentage)
        {
            _configuration.Setup(x => x.GetSection("Business:DayInterest").Value).Returns(interest);
            var dayBalanceBusiness = new DayBalanceBusiness(_dayBalanceRepository.Object, _financialEntryValidateService.Object, _configuration.Object);
            var entiry             = new DayBalanceEntity()
            {
                Balance = balance
            };

            var result = dayBalanceBusiness.CalculateInterest(entiry);

            Assert.Equal(percentage, result);
        }
Beispiel #3
0
        public void FillDayBalance(decimal currentValue, decimal totalOut, decimal totalEntry, decimal expectedBalance, decimal expectedInterest)
        {
            _configuration.Setup(x => x.GetSection("Business:DayInterest").Value).Returns("0,83");
            var dayBalanceBusiness   = new DayBalanceBusiness(_dayBalanceRepository.Object, _financialEntryValidateService.Object, _configuration.Object);
            var financialEntryEntity = new FinancialEntryEntity()
            {
                EntryType = FinancialEntryTypeEnum.Payment,
                Value     = currentValue
            };
            var dayBalanceEntity = new DayBalanceEntity()
            {
                TotalOut   = totalOut,
                TotalEntry = totalEntry
            };
            var result = dayBalanceBusiness.FillDayBalance(financialEntryEntity, dayBalanceEntity).GetAwaiter().GetResult();

            Assert.Equal(expectedBalance, result.Balance);
            Assert.Equal(expectedInterest, result.Interest);
            Assert.Equal((currentValue + totalOut), result.TotalOut);
            Assert.Equal(totalEntry, result.TotalEntry);
        }