public async Task Should_Success_Create_Data()
        {
            GarmentInvoicePaymentService service = new GarmentInvoicePaymentService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            GarmentInvoicePaymentModel   model   = _dataUtil(service, GetCurrentMethod()).GetNewData();
            var Response = await service.CreateAsync(model);

            Assert.NotEqual(0, Response);
        }
        public async Task Should_Success_Get_Data_By_Id()
        {
            GarmentInvoicePaymentService service = new GarmentInvoicePaymentService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            GarmentInvoicePaymentModel   model   = await _dataUtil(service, GetCurrentMethod()).GetTestData();

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

            Assert.NotNull(Response);
        }
        public async Task Should_Success_Get_Data()
        {
            GarmentInvoicePaymentService service = new GarmentInvoicePaymentService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service, GetCurrentMethod()).GetTestData();

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

            Assert.NotEmpty(Response.Data);
        }
        public async Task Should_Success_Update_Data()
        {
            GarmentInvoicePaymentService service = new GarmentInvoicePaymentService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));


            GarmentInvoicePaymentModel model = await _dataUtil(service, GetCurrentMethod()).GetTestData();

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

            //newModel.BGCheckNumber = "newBG";
            var Response1 = await service.UpdateAsync(newModel.Id, newModel);

            Assert.NotEqual(0, Response1);

            GarmentInvoicePaymentModel model2 = await _dataUtil(service, GetCurrentMethod()).GetTestData();

            //var newModel2 = await service.ReadByIdAsync(model.Id);
            GarmentInvoicePaymentModel newModel2 = new GarmentInvoicePaymentModel();

            newModel2.Id = model2.Id;

            newModel2.Items = new List <GarmentInvoicePaymentItemModel> {
                model2.Items.First()
            };
            var Response = await service.UpdateAsync(model2.Id, newModel2);

            Assert.NotEqual(0, Response);

            GarmentInvoicePaymentItemModel newItem = new GarmentInvoicePaymentItemModel
            {
                InvoiceId = 3,
                InvoiceNo = "no3",
                Amount    = 3,
                IDRAmount = 3
            };

            newModel2.Items.Add(newItem);
            var Response3 = await service.UpdateAsync(model2.Id, newModel2);

            Assert.NotEqual(0, Response);
        }
Пример #5
0
 public GarmentInvoicePaymentDataUtil(GarmentInvoicePaymentService service)
 {
     Service = service;
 }
 private GarmentInvoicePaymentDataUtil _dataUtil(GarmentInvoicePaymentService service, string testname)
 {
     return(new GarmentInvoicePaymentDataUtil(service));
 }