public async Task Should_Success_Update()
        {
            var serviceProvider = GetServiceProvider();
            InventorySummaryService inventorySummaryService = new InventorySummaryService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IInventorySummaryService)))
            .Returns(inventorySummaryService);

            InventoryMovementService inventoryMovementService = new InventoryMovementService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IInventoryMovementService)))
            .Returns(inventoryMovementService);

            InventoryDocumentService inventoryDocumentFacade = new InventoryDocumentService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IInventoryDocumentService)))
            .Returns(inventoryDocumentFacade);
            NewFpRegradingResultDocsService service = new NewFpRegradingResultDocsService(serviceProvider.Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestData();

            var vm       = service.MapToViewModel(data);
            var testData = service.MapToModel(vm);

            testData.Details.Add(new FpRegradingResultDocsDetails
            {
                Grade       = "a",
                Length      = 12,
                ProductCode = "code",
                ProductId   = "1",
                ProductName = "name",
                Quantity    = 1,
                Remark      = "remar",
                Retur       = "retur"
            });
            testData.UnitName = "a";

            var response = await service.UpdateAsync(testData.Id, testData);

            Assert.NotEqual(0, response);


            var newData = await service.ReadByIdAsync(data.Id);

            var vm2       = service.MapToViewModel(newData);
            var testData2 = service.MapToModel(vm2);

            testData2.Details.Clear();
            var newResponse = await service.UpdateAsync(testData2.Id, testData2);

            Assert.NotEqual(0, newResponse);
        }
        public async Task Should_Success_ValidateVM()
        {
            var serviceProvider = GetServiceProvider();

            InventorySummaryService inventorySummaryService = new InventorySummaryService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IInventorySummaryService)))
            .Returns(inventorySummaryService);

            InventoryMovementService inventoryMovementService = new InventoryMovementService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IInventoryMovementService)))
            .Returns(inventoryMovementService);

            InventoryDocumentService inventoryDocumentFacade = new InventoryDocumentService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IInventoryDocumentService)))
            .Returns(inventoryDocumentFacade);

            NewFpRegradingResultDocsService service = new NewFpRegradingResultDocsService(serviceProvider.Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestData();

            var vm = service.MapToViewModel(data);
            ValidationContext validationContext = new ValidationContext(vm, serviceProvider.Object, null);
            var response = vm.Validate(validationContext);

            Assert.True(response.Count() == 0);
        }
        public async Task Should_Success_MapToViewModel()
        {
            var serviceProvider = GetServiceProvider();
            InventorySummaryService inventorySummaryService = new InventorySummaryService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IInventorySummaryService)))
            .Returns(inventorySummaryService);

            InventoryMovementService inventoryMovementService = new InventoryMovementService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IInventoryMovementService)))
            .Returns(inventoryMovementService);

            InventoryDocumentService inventoryDocumentFacade = new InventoryDocumentService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IInventoryDocumentService)))
            .Returns(inventoryDocumentFacade);
            NewFpRegradingResultDocsService service = new NewFpRegradingResultDocsService(serviceProvider.Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestData();

            var model = service.MapToViewModel(data);

            Assert.NotNull(model);
        }