Ejemplo n.º 1
0
        public async Task <DailyBankTransactionModel> GetTestDataIn()
        {
            DailyBankTransactionModel model = GetNewData();
            await Service.CreateAsync(model);

            return(await Service.ReadByIdAsync(model.Id));
        }
Ejemplo n.º 2
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);
        }
Ejemplo 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);
        }
Ejemplo n.º 4
0
        public async Task Should_Success_Delete_By_ReferenceNo_NextMonth_Exist()
        {
            DailyBankTransactionService service = new DailyBankTransactionService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            DailyBankTransactionModel   model   = _dataUtil(service).GetNewData();

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

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

            modelNextMonth.Date = new DateTime(2018, 2, 1);
            var modelNextMonthResponse = await service.CreateAsync(modelNextMonth);

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

            Assert.NotEqual(0, Response);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }