public void GetNewStockMovementIdTest()
        {
            // Act
            var result = IdService.GetNewStockMovementId(context);

            // Assert
            Assert.IsNotNull(result);
        }
        public void TestInitialize()
        {
            context = new ApplicationDbContext();

            stockmovementService = new StockMovementService(context);
            itemService          = new ItemService(context);

            stockmovementRepository = new StockMovementRepository(context);

            ddRepository           = new DisbursementDetailRepository(context);
            sadRepository          = new StockAdjustmentDetailRepository(context);
            dodRepository          = new DeliveryOrderDetailRepository(context);
            disbursementRepository = new DisbursementRepository(context);
            doRepository           = new DeliveryOrderRepository(context);
            saRepository           = new StockAdjustmentRepository(context);

            //create new test object and save into db
            StockMovement sm = new StockMovement()
            {
                StockMovementId   = IdService.GetNewStockMovementId(context),
                DisbursementId    = "TEST",
                StockAdjustmentId = "TEST",
                DeliveryOrderNo   = "TEST",
                Item             = context.Item.Where(x => x.ItemCode == "C003").First(),
                CreatedDateTime  = DateTime.Now,
                OriginalQuantity = 1,
                AfterQuantity    = 2
            };

            stockmovementRepository.Save(sm);

            //create new disbursement object and save into db
            Disbursement disbursement = new Disbursement();

            if (disbursementRepository.FindById("TEST") == null)
            {
                disbursement.DisbursementId  = "TEST";
                disbursement.CreatedDateTime = DateTime.Now;
            }
            else
            {
                disbursement = disbursementRepository.FindById("TEST");
            }
            disbursementRepository.Save(disbursement);

            //create new DisbursementDetail object and save into db
            DisbursementDetail detail = new DisbursementDetail()
            {
                DisbursementId = "TEST",
                Item           = context.Item.First(),
                PlanQuantity   = 3,
                ActualQuantity = 3
            };

            ddRepository.Save(detail);

            //create new DO object and save into db
            DeliveryOrder d = new DeliveryOrder();

            if (doRepository.FindById("TEST") == null)
            {
                d.DeliveryOrderNo = "TEST";
                d.CreatedDateTime = DateTime.Now;
            }
            else
            {
                d = doRepository.FindById("TEST");
            }
            doRepository.Save(d);

            //create new DO detail object and save into db
            DeliveryOrderDetail dod = new DeliveryOrderDetail()
            {
                DeliveryOrder  = d,
                Item           = context.Item.First(),
                PlanQuantity   = 4,
                ActualQuantity = 4
            };

            dodRepository.Save(dod);

            //create new SA object and save into db
            StockAdjustment SA = new StockAdjustment();

            if (saRepository.FindById("TEST") == null)
            {
                SA.StockAdjustmentId = "TEST";
                SA.CreatedDateTime   = DateTime.Now;
            }
            else
            {
                SA = saRepository.FindById("TEST");
            }
            saRepository.Save(SA);

            //create new SA detail object and save into db
            StockAdjustmentDetail SADetail = new StockAdjustmentDetail()
            {
                StockAdjustment  = SA,
                Item             = context.Item.First(),
                OriginalQuantity = 2,
                AfterQuantity    = 4
            };

            sadRepository.Save(SADetail);
        }