public async Task Should_Success_CreateAsync() { FpReturnFromBuyerService service = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); var data = DataUtil(service).GetNewData(); var response = await service.CreateAsync(data); Assert.NotEqual(0, response); }
public async Task Should_Fail_DeleteAsync() { FpReturnFromBuyerService service = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); FpReturnFromBuyerService utilService = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); var data = await DataUtil(utilService).GetTestData(); await Assert.ThrowsAnyAsync <Exception>(() => service.DeleteAsync(data.Id)); }
public async Task Should_Failed_VoidTransactionById_InvalidId() { FpReturnFromBuyerService service = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); FpReturnFromBuyerService utilService = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); var data = await DataUtil(utilService).GetTestData(); await Assert.ThrowsAnyAsync <Exception>(() => service.VoidDocumentById(0)); }
public async Task Should_Success_ReadById() { FpReturnFromBuyerService utilService = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); var data = await DataUtil(utilService).GetTestData(); var model = await utilService.ReadByIdAsync(data.Id); Assert.NotNull(model); }
public void Should_Success_MapToModel() { FpReturnFromBuyerService utilService = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); var data = DataUtil(utilService).GetEmptyData(); var model = utilService.MapToModel(data); Assert.NotNull(model); }
public async Task Should_Success_VoidTransactionById() { FpReturnFromBuyerService service = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); FpReturnFromBuyerService utilService = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); var data = await DataUtil(utilService).GetTestData(); var response = await service.VoidDocumentById(data.Id); Assert.NotEqual(0, response); }
public async Task Should_Success_ValidateVM() { var serviceProvider = GetServiceProvider(); FpReturnFromBuyerService utilService = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); var data = await DataUtil(utilService).GetTestData(); var vm = utilService.MapToViewModel(data); ValidationContext validationContext = new ValidationContext(vm, serviceProvider.Object, null); var response = vm.Validate(validationContext); Assert.True(response.Count() > 0); }
public FpReturnFromBuyerDataUtil(FpReturnFromBuyerService service) { Service = service; }
private FpReturnFromBuyerDataUtil DataUtil(FpReturnFromBuyerService service) { return(new FpReturnFromBuyerDataUtil(service)); }
public void Should_Succes_Map_To_ViewModel() { var viewModel = new FpReturnFromBuyerViewModel() { Buyer = new BuyerViewModel() { Code = "BuyerCode", Id = 1, Name = "BuyerName" }, Code = "Code", CodeProduct = "CodeProduct", CoverLetter = "CoverLetter", Date = DateTime.Now, Destination = "Destination", Details = new List <FpReturnFromBuyerDetailViewModel>() { new FpReturnFromBuyerDetailViewModel() { Items = new List <FpReturnFromBuyerItemViewModel>() { new FpReturnFromBuyerItemViewModel() { ColorWay = "ColorWay", DesignCode = "DesignCode", DesignNumber = "DesignNumber", Length = 1, ProductCode = "ProductCode", ProductId = 1, ProductName = "ProductName", Remark = "", ReturnQuantity = 1, UOM = "UOM", UOMId = 1, Weight = 1 } }, ProductionOrder = new ProductionOrderIntegrationViewModel() { DistributedQuantity = 1, IsCompleted = false, OrderNo = "OrderNo", Id = 1, OrderQuantity = 1, OrderType = new OrderTypeIntegrationViewModel() { Code = "OrderTypeCode", Id = 1, Name = "OrderTypeName" } } } }, SpkNo = "SpkNo", Storage = new StorageIntegrationViewModel() { code = "StorageCode", name = "StorageName", _id = 1 } }; FpReturnFromBuyerService service = new FpReturnFromBuyerService(DbContext(GetCurrentMethod()), GetServiceProvider().Object, GetInventoryDocumentService().Object); var model = service.MapToModel(viewModel); Assert.NotNull(model); }