Exemple #1
0
        public void CalculateDayPositionPercentage(decimal yesterdayTootal, decimal currentDayTotal, decimal expectedResult)
        {
            var financialEntryBusiness = new FinancialEntryBusiness(_paymentQueue.Object, _receiptQueue.Object, _financialEntryRepository.Object, _financialEntryValidateService.Object, _dayBalanceBusiness.Object, _configuration.Object);
            var result = financialEntryBusiness.CalculateDayPositionPercentage(yesterdayTootal, currentDayTotal);

            Assert.Equal(expectedResult, result);
        }
Exemple #2
0
 public void AddToQueueNotDateInThePastException()
 {
     try
     {
         var now       = DateTime.Now;
         var yesterday = now.AddDays(-1);
         _configuration.Setup(x => x.GetSection("Business:DayAccountLimit").Value).Returns("20000,00");
         _financialEntryValidateService.Setup(x => x.IsEntryInThePast(yesterday, now)).Returns(true);
         var financialEntryBusiness = new FinancialEntryBusiness(_paymentQueue.Object, _receiptQueue.Object, _financialEntryRepository.Object, _financialEntryValidateService.Object, _dayBalanceBusiness.Object, _configuration.Object);
         financialEntryBusiness.AddToQueue(new FinancialEntryEntity()).GetAwaiter().GetResult();
     }
     catch (ApiException ex)
     {
         Assert.Equal(HttpStatusCode.BadRequest, ex.HttpStatusCode);
     }
 }
Exemple #3
0
 public void AddToQueueDayAccountLimitException()
 {
     try
     {
         var financialEntryEntity = new FinancialEntryEntity()
         {
             EntryType = FinancialEntryTypeEnum.Payment
         };
         var now      = DateTime.Now;
         var tomorrow = now.AddDays(1);
         _configuration.Setup(x => x.GetSection("Business:DayAccountLimit").Value).Returns("20000,00");
         _financialEntryValidateService.Setup(x => x.IsEntryInThePast(tomorrow, now)).Returns(false);
         var financialEntryBusiness = new FinancialEntryBusiness(_paymentQueue.Object, _receiptQueue.Object, _financialEntryRepository.Object, _financialEntryValidateService.Object, _dayBalanceBusiness.Object, _configuration.Object);
         financialEntryBusiness.AddToQueue(financialEntryEntity).GetAwaiter().GetResult();
     }
     catch (ApiException ex)
     {
         Assert.Equal(HttpStatusCode.UnprocessableEntity, ex.HttpStatusCode);
     }
 }