public async Task <GarmentFinanceMemorialModel> GetTestData()
        {
            GarmentFinanceMemorialModel model = GetNewData();
            await Service.CreateAsync(model);

            return(await Service.ReadByIdAsync(model.Id));
        }
Ejemplo n.º 2
0
        public async Task Should_Success_Get_Data_By_Id()
        {
            GarmentFinanceMemorialService service = new GarmentFinanceMemorialService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            GarmentFinanceMemorialModel   model   = await _dataUtil(service, GetCurrentMethod()).GetTestData();

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

            Assert.NotNull(Response);
        }
Ejemplo n.º 3
0
        public async Task Should_Success_Update_Data()
        {
            GarmentFinanceMemorialService service = new GarmentFinanceMemorialService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));


            GarmentFinanceMemorialModel 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);

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

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

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

            Assert.NotEqual(0, Response);

            GarmentFinanceMemorialItemModel newItem = new GarmentFinanceMemorialItemModel
            {
                COAId   = 3,
                COACode = "no3",
                COAName = "Name",
                Debit   = 3,
                Credit  = 0
            };

            GarmentFinanceMemorialItemModel newItem2 = new GarmentFinanceMemorialItemModel
            {
                COAId   = 3,
                COACode = "no3",
                COAName = "Name",
                Credit  = 3,
                Debit   = 0
            };

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

            Assert.NotEqual(0, Response);
        }