Пример #1
0
        public void Should_No_Error_Validate_Data()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var service   = new NewShipmentDocumentService(GetServiceProvider(dbContext).Object, dbContext);
            var vm        = _dataUtil(service, _dbContext(GetCurrentMethod())).GetDataToValidate();

            Assert.True(vm.Validate(null).Count() == 0);
        }
Пример #2
0
        public async Task Should_Success_Get_Data()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var service   = new NewShipmentDocumentService(GetServiceProvider(dbContext).Object, dbContext);
            var data      = await _dataUtil(service, _dbContext(GetCurrentMethod())).GetTestData();

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

            Assert.NotEmpty(Response.Data);
        }
Пример #3
0
        public async Task Should_Success_Create_Data()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var service   = new NewShipmentDocumentService(GetServiceProvider(dbContext).Object, dbContext);
            var model     = await _dataUtil(service, _dbContext(GetCurrentMethod())).GetNewData();

            var Response = await service.CreateAsync(model);

            Assert.NotEqual(0, Response);
        }
Пример #4
0
        public async Task Should_Success_Get_Data_By_Id()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var service   = new NewShipmentDocumentService(GetServiceProvider(dbContext).Object, dbContext);
            var model     = await _dataUtil(service, _dbContext(GetCurrentMethod())).GetTestData();

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

            Assert.NotNull(Response);
        }
Пример #5
0
        public async Task Should_Success_Get_Shipment_Product()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var service   = new NewShipmentDocumentService(GetServiceProvider(dbContext).Object, dbContext);
            var model     = await _dataUtil(service, _dbContext(GetCurrentMethod())).GetTestData();

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

            var result = await service.GetShipmentProducts(createdModel.Details.FirstOrDefault().ProductionOrderId, createdModel.BuyerId);

            Assert.NotEmpty(result);
        }
Пример #6
0
        public async Task Should_Success_Update_Data()
        {
            var dbContext = _dbContext(GetCurrentMethod());
            var service   = new NewShipmentDocumentService(GetServiceProvider(dbContext).Object, dbContext);
            var model     = await _dataUtil(service, _dbContext(GetCurrentMethod())).GetTestData();

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

            newModel.DeliveryReference = "NewDescription";
            var Response = await service.UpdateAsync(newModel.Id, newModel);

            Assert.NotEqual(0, Response);
        }
 public NewShipmentDocumentDataUtil(NewShipmentDocumentService service, ProductionDbContext dbContext)
 {
     Service    = service;
     _dbContext = dbContext;
 }
Пример #8
0
 private NewShipmentDocumentDataUtil _dataUtil(NewShipmentDocumentService service, ProductionDbContext dbContext)
 {
     return(new NewShipmentDocumentDataUtil(service, dbContext));
 }