Exemplo n.º 1
0
        public void Should_No_Error_Validate_Data()
        {
            DailyBankTransactionService   service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionViewModel vm      = _dataUtil(service).GetDataToValidate();

            Assert.True(vm.Validate(null).Count() == 0);
        }
Exemplo n.º 2
0
        public void Should_Success_GenerateExcel_when_dataEmpty()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var Response = service.GetExcel(0, 7, 1001, 0);

            Assert.NotNull(Response);
        }
Exemplo n.º 3
0
        public async Task Should_Success_Create_Data()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = _dataUtil(service).GetNewData();
            var Response = await service.CreateAsync(model);

            Assert.NotEqual(0, Response);
        }
Exemplo n.º 4
0
        public void Should_Success_ReportDailyBalance_Excel_When_DataNoExist()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            var result = service.GenerateExcelDailyBalance(1, DateTime.Now.AddDays(-7), DateTime.Now.AddDays(7), "G", 1);

            Assert.NotNull(result);
        }
Exemplo n.º 5
0
        public async Task Should_Success_Get_Report()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestDataIn();

            var Response = service.GetReport(data.AccountBankId, data.Date.Month, data.Date.Year, 1);

            Assert.NotEmpty(Response.Data);
        }
        public async Task Should_Success_GetReportAll_In()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestDataIn();

            var Response = service.GetReportAll(data.Code, 0, string.Empty, data.Date, data.Date, 1, 25, "{}", null, data.Code, "{\"Status\":\"IN\"}");

            Assert.NotEmpty(Response.Data);
        }
        public async Task Should_Success_GetDocumentNo()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestDataOut();

            var Response = await service.GetDocumentNo("K", "test", "test");

            Assert.NotEmpty(Response);
        }
        public async Task Should_Success_GetLoader()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestDataIn();

            var Response = service.GetLoader(data.ReferenceNo, "{\"Status\":\"IN\"}");

            Assert.NotEmpty(Response.Data);
        }
Exemplo n.º 9
0
        public async Task Should_Success_Get_Data_By_Id()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = await _dataUtil(service).GetTestDataIn();

            var Response = await service.ReadByIdAsync(model.Id);

            Assert.NotNull(Response);
        }
Exemplo n.º 10
0
        public async Task Should_Success_GetDataAccountBank()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestDataIn();

            var response = service.GetDataAccountBank(data.AccountBankId);

            Assert.NotEmpty(response);
        }
Exemplo n.º 11
0
        public async Task Should_Success_GetBeforeBalance()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestDataIn();

            var response = service.GetBeforeBalance(data.AccountBankId, data.Date.Month, data.Date.Year, 7);

            //Assert.NotEqual(0,response);
        }
Exemplo n.º 12
0
        public async Task Should_Success_Get_Data_In()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestDataIn();

            var Response = service.Read(1, 25, "{}", null, data.Code, "{}");

            Assert.NotEmpty(Response.Data);
        }
Exemplo n.º 13
0
        public async Task Should_Success_Posting_Transaction()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var model = _dataUtil(service).GetNewData();
            await service.CreateInOutTransactionAsync(model);

            var response = await service.Posting(new List <int>() { model.Id });

            Assert.True(response > 0);
        }
        public async Task Should_Fail_CreateInOut_Data()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = _dataUtil(service).GetNewData();

            model.Status     = null;
            model.SourceType = "Pendanaan";
            //var Response = await service.CreateInOutTransactionAsync(model);
            await Assert.ThrowsAnyAsync <Exception>(() => service.CreateInOutTransactionAsync(model));
        }
Exemplo n.º 15
0
        public async Task Should_Success_Delete_Data()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = await _dataUtil(service).GetTestDataNotPosted();

            var newModel = await service.ReadByIdAsync(model.Id);

            var Response = await service.DeleteAsync(newModel.Id);

            Assert.NotEqual(0, Response);
        }
        public void ShouldSuccessAutoMapper()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));

            Mapper.Initialize(cfg => cfg.AddProfile <DailyBankTransactionProfile>());
            Mapper.AssertConfigurationIsValid();
            var model = _dataUtil(service).GetNewData();
            var vm    = Mapper.Map <DailyBankTransactionViewModel>(model);

            Assert.True(true);
        }
Exemplo n.º 17
0
        public async Task Should_Success_ReportDailyBalance_Excel()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = _dataUtil(service).GetNewData();

            model.Status     = "OUT";
            model.SourceType = "Pendanaan";
            await service.CreateInOutTransactionAsync(model);

            var data = service.GenerateExcelDailyBalance(model.AccountBankId, DateTime.Now.AddDays(-7), DateTime.Now.AddDays(7), "G", 1);

            Assert.NotNull(data);
        }
Exemplo n.º 18
0
        public async Task Should_Success_Delete_By_ReferenceNo()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = _dataUtil(service).GetNewData();

            model.Date   = new DateTime(2018, 1, 1);
            model.Status = "IN";
            var modelResponse = await service.CreateAsync(model);

            var Response = await service.DeleteByReferenceNoAsync(model.ReferenceNo);

            Assert.NotEqual(0, Response);
        }
Exemplo n.º 19
0
        public async Task Should_Success_GenerateExcel()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestDataIn();

            var Response = service.GetExcel(data.AccountBankId, data.Date.Month, data.Date.Year, 1);

            Assert.NotNull(Response);

            data.AccountBankId = 2;
            var Response2 = service.GetExcel(data.AccountBankId, data.Date.Month, data.Date.Year, 1);

            Assert.NotNull(Response2);
        }
        public async Task Should_Success_Posting_Pendanaan_Internal_Transaction()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var model = _dataUtil(service).GetNewData();

            model.SourceType        = "Pendanaan";
            model.SourceFundingType = "Internal";
            //model.BankCharges = 100;

            await service.CreateInOutTransactionAsync(model);

            var response = await service.Posting(new List <int>() { model.Id });

            Assert.True(response > 0);
        }
Exemplo n.º 21
0
        public async Task Should_Success_CreateInOut_Data()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = _dataUtil(service).GetNewData();

            model.Status     = "OUT";
            model.SourceType = "Pendanaan";
            var Response = await service.CreateInOutTransactionAsync(model);

            Assert.NotEqual(0, Response);
            var vm = _dataUtil(service).GetDataToValidate();

            vm.Status     = "OUT";
            vm.SourceType = "Pendanaan";
            Assert.True(vm.Validate(null).Count() > 0);
        }
Exemplo n.º 22
0
        public async Task Should_Success_Create_December()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = _dataUtil(service).GetNewData();

            model.Date = new DateTime(2018, 1, 1);
            var modelResponse = await service.CreateAsync(model);

            DailyBankTransactionModel previousMonthModel = _dataUtil(service).GetNewData();

            previousMonthModel.Date = new DateTime(2017, 12, 1);

            var Response = await service.CreateAsync(previousMonthModel);

            Assert.NotEqual(0, Response);
        }
Exemplo n.º 23
0
        public async Task Should_Succes_When_Create_New_Data_With_Non_Exist_Next_Month_Or_Previous_Month_Balance()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = _dataUtil(service).GetNewData();

            if (DateTime.Now.Month < 7)
            {
                model.Date = new DateTime(DateTime.Now.Year - 1, 8, 1);
            }
            else
            {
                model.Date = model.Date.AddMonths(-6);
            }

            var Response = await service.CreateAsync(model);

            Assert.NotEqual(0, Response);
        }
        public async Task Should_Success_Update_Data()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = await _dataUtil(service).GetTestDataNotPosted();

            var newModel = await service.ReadByIdAsync(model.Id);

            newModel.ReferenceNo = "";
            newModel.SourceType  = "Pendanaan";
            var Response = await service.UpdateAsync(newModel.Id, newModel);

            Assert.NotEqual(0, Response);

            newModel.ReferenceNo = "";
            newModel.Status      = "IN";
            var Response2 = await service.UpdateAsync(newModel.Id, newModel);

            Assert.NotEqual(0, Response2);
        }
Exemplo n.º 25
0
        public async Task Should_Success_IsPosted_Transaction()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var service   = new DailyBankTransactionService(GetServiceProvider().Object, dbContext);
            var model     = _dataUtil(service).GetNewData();

            var monthlyBalance = new List <BankTransactionMonthlyBalanceModel>()
            {
                new BankTransactionMonthlyBalanceModel()
                {
                    Month         = 10,
                    Year          = 2019,
                    AccountBankId = model.AccountBankId
                },
                new BankTransactionMonthlyBalanceModel()
                {
                    Month         = 8,
                    Year          = 2019,
                    AccountBankId = model.AccountBankId
                },
                new BankTransactionMonthlyBalanceModel()
                {
                    Month         = 12,
                    Year          = 2019,
                    AccountBankId = model.AccountBankId
                }
            };

            foreach (var datum in monthlyBalance)
            {
                EntityExtension.FlagForCreate(datum, "Test", "Test");
            }

            dbContext.BankTransactionMonthlyBalances.AddRange(monthlyBalance);
            dbContext.SaveChanges();

            model.IsPosted = true;
            var response = await service.CreateAsync(model);

            Assert.NotEqual(0, response);
        }
Exemplo n.º 26
0
 public DailyBankTransactionDataUtil(DailyBankTransactionService service)
 {
     Service = service;
 }
Exemplo n.º 27
0
 private DailyBankTransactionDataUtil _dataUtil(DailyBankTransactionService service)
 {
     return(new DailyBankTransactionDataUtil(service));
 }