public void Should_Success_Get_Data_DispositionMemoLoader()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var facade    = new PurchasingDispositionFacade(ServiceProvider, dbContext);

            var Response = facade.GetDispositionMemoLoader(0);

            Assert.Null(Response);

            var purhcasingDisposition = new PurchasingDisposition()
            {
                Id = 1, CurrencyCode = "IDR"
            };
            var purchasingDispositionItem = new PurchasingDispositionItem()
            {
                PurchasingDispositionId = 1, UseVat = true, UseIncomeTax = true, EPONo = "1"
            };
            var unitPaymentOrder = new UnitPaymentOrder()
            {
                Id = 1
            };
            var unitPaymentOrderItem = new UnitPaymentOrderItem()
            {
                Id = 1, UPOId = 1
            };
            var unitPaymentOrderDetail = new UnitPaymentOrderDetail()
            {
                EPONo = "1", UPOItemId = 1
            };

            dbContext.PurchasingDispositions.Add(purhcasingDisposition);
            dbContext.PurchasingDispositionItems.Add(purchasingDispositionItem);
            dbContext.UnitPaymentOrders.Add(unitPaymentOrder);
            dbContext.UnitPaymentOrderItems.Add(unitPaymentOrderItem);
            dbContext.UnitPaymentOrderDetails.Add(unitPaymentOrderDetail);
            dbContext.SaveChanges();

            var Response2 = facade.GetDispositionMemoLoader(1);

            Assert.NotNull(Response2);
        }
        public async void Should_Success_Update_Data()
        {
            PurchasingDispositionFacade facade = new PurchasingDispositionFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var model = await _dataUtil(facade, GetCurrentMethod()).GetTestData();

            var modelItem   = _dataUtil(facade, GetCurrentMethod()).GetNewData().Items.First();
            var modelDetail = modelItem.Details.First();

            //model.Items.Clear();
            modelItem.EPONo = "test";
            var ResponseAdd1 = await facade.Update((int)model.Id, model, USERNAME);

            Assert.NotEqual(ResponseAdd1, 0);

            var dispoItem =
                new PurchasingDispositionItem
            {
                EPOId         = modelItem.EPOId,
                EPONo         = modelItem.EPONo,
                IncomeTaxId   = "1",
                IncomeTaxName = "tax",
                IncomeTaxRate = 1,
                UseIncomeTax  = true,
                UseVat        = true,
                Details       = new List <PurchasingDispositionDetail>
                {
                    new PurchasingDispositionDetail
                    {
                        //EPODetailId=modelDetail.EPODetailId,
                        CategoryCode     = "test",
                        CategoryId       = "1",
                        CategoryName     = "test",
                        DealQuantity     = 10,
                        PaidQuantity     = 1000,
                        DealUomId        = "1",
                        DealUomUnit      = "test",
                        PaidPrice        = 1000,
                        PricePerDealUnit = 100,
                        PriceTotal       = 10000,
                        PRId             = "1",
                        PRNo             = "test",
                        ProductCode      = "test",
                        ProductName      = "test",
                        ProductId        = "1",
                        UnitName         = "test",
                        UnitCode         = "test",
                        UnitId           = "1",
                    }
                }
            };
            var dispoDetail = new PurchasingDispositionDetail
            {
                //EPODetailId = modelDetail.EPODetailId,
                CategoryCode     = "test",
                CategoryId       = "1",
                CategoryName     = "test",
                DealQuantity     = 10,
                PaidQuantity     = 1000,
                DealUomId        = "1",
                DealUomUnit      = "test",
                PaidPrice        = 1000,
                PricePerDealUnit = 100,
                PriceTotal       = 10000,
                PRId             = "1",
                PRNo             = "test",
                ProductCode      = "test",
                ProductName      = "test",
                ProductId        = "1",
            };

            model.Items.First().Details.Add(dispoDetail);
            var ResponseAddDetail = await facade.Update((int)model.Id, model, USERNAME);

            Assert.NotEqual(ResponseAddDetail, 0);

            var ResponseAddDetail2 = await facade.Update((int)model.Id, model, USERNAME);

            Assert.NotEqual(ResponseAddDetail2, 0);

            model.Items.First().Details.Remove(modelDetail);
            var ResponseAddDetail1 = await facade.Update((int)model.Id, model, USERNAME);

            Assert.NotEqual(ResponseAddDetail1, 0);

            model.Items.Add(dispoItem);
            var ResponseAdd = await facade.Update((int)model.Id, model, USERNAME);

            Assert.NotEqual(ResponseAdd, 0);


            model.Items.Remove(modelItem);
            var ResponseAdd2 = await facade.Update((int)model.Id, model, USERNAME);

            Assert.NotEqual(ResponseAdd2, 0);
        }