public async void Validate_ViewModel_Duplicate()
        {
            var serviceProvider = GetServiceProvider();

            var service = new GarmentLeftoverWarehouseProductService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IGarmentLeftoverWarehouseProductService)))
            .Returns(service);

            var data = await _dataUtil(service).GetTestData();

            var viewModel = new GarmentLeftoverWarehouseProductViewModel
            {
                Code            = data.Code,
                Name            = data.Name,
                UomId           = data.UomId,
                UomUnit         = data.UomUnit,
                ProductTypeId   = data.ProductTypeId,
                ProductTypeCode = data.ProductTypeCode,
                ProductTypeName = data.ProductTypeName
            };

            var validationContext = new ValidationContext(viewModel, serviceProvider.Object, null);

            var result = viewModel.Validate(validationContext);

            Assert.NotEmpty(result.ToList());
        }
        public async void Should_Success_Get_Data_By_Id()
        {
            var service = new GarmentLeftoverWarehouseProductService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data    = await _dataUtil(service).GetTestData();

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

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

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

            Assert.NotEmpty(Response.Data);
        }
        public async void Should_Success_Create_Data()
        {
            var service = new GarmentLeftoverWarehouseProductService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data    = _dataUtil(service).GetNewData();

            var Response = await service.CreateAsync(data);

            Assert.NotEqual(0, Response);
        }
 public GarmentLeftoverWarehouseProductDataUtil(GarmentLeftoverWarehouseProductService service)
 {
     Service = service;
 }
 private GarmentLeftoverWarehouseProductDataUtil _dataUtil(GarmentLeftoverWarehouseProductService service)
 {
     return(new GarmentLeftoverWarehouseProductDataUtil(service));
 }