public CommonController(IWorkContext webWorkContext, PurchaseDataService purchaseDataService, LocalizationService localizationService, GoodsDataService goodsDataService, SupplierDataService supplierDataService, WarehouseService warehouseService, InventoryDataService inventoryDataService, GoodsSpecificationService goodsSpecificationService, ClientTypeService clientTypeService, SalesShipmentsDataService salesShipmentsDataService, GoodsTypeService goodsTypeService, SupplierTypeService supplierTypeService) { _webWorkContext = webWorkContext; _purchaseDataService = purchaseDataService; _localizationService = localizationService; _goodsDataService = goodsDataService; _supplierDataService = supplierDataService; _warehouseService = warehouseService; _inventoryDataService = inventoryDataService; _goodsSpecificationService = goodsSpecificationService; _clientTypeService = clientTypeService; _salesShipmentsDataService = salesShipmentsDataService; _goodsTypeService = goodsTypeService; _supplierTypeService = supplierTypeService; }
public void GetSupplierTypesPaged_Success_Test() { // Arrange string searchTerm = ""; int pageIndex = 0; int pageSize = 10; // list IList <R_SupplierType> list = new List <R_SupplierType>(); for (int i = 1; i <= pageSize; i++) { list.Add(SampleSupplierType(i)); } // create mock for repository var mock = new Mock <ISupplierTypeRepository>(); mock.Setup(s => s.GetSupplierTypes(Moq.It.IsAny <string>(), Moq.It.IsAny <int>(), Moq.It.IsAny <int>())).Returns(list); // service SupplierTypeService supplierTypeService = new SupplierTypeService(); SupplierTypeService.Repository = mock.Object; // Act var resultList = supplierTypeService.GetSupplierTypes(searchTerm, pageIndex, pageSize); SupplierTypeDTO result = resultList.FirstOrDefault(); // Assert Assert.IsNotNull(result); Assert.AreEqual(1, result.SupplierTypeId); Assert.AreEqual(10, resultList.Count); }
public void GetSupplierTypes_Success_Test() { // Arrange R_SupplierType supplierType = SampleSupplierType(1); IList <R_SupplierType> list = new List <R_SupplierType>(); list.Add(supplierType); // create mock for repository var mock = new Mock <ISupplierTypeRepository>(); mock.Setup(s => s.GetSupplierTypes()).Returns(list); // service SupplierTypeService supplierTypeService = new SupplierTypeService(); SupplierTypeService.Repository = mock.Object; // Act var resultList = supplierTypeService.GetSupplierTypes(); SupplierTypeDTO result = resultList.FirstOrDefault(); // Assert Assert.IsNotNull(result); Assert.AreEqual(1, result.SupplierTypeId); }
public SupplierTypeController(IWorkContext webWorkContext, SupplierTypeService supplierTypeService, LocalizationService localizationService) { _webWorkContext = webWorkContext; _supplierTypeService = supplierTypeService; _localizationService = localizationService; }
public void GetSupplierTypeListAdvancedSearch_Success_Test() { // Arrange string name = null; string description = null; bool? active = null; //int pageIndex = 0; int pageSize = 10; // list IList <R_SupplierType> list = new List <R_SupplierType>(); for (int i = 1; i <= pageSize; i++) { list.Add(SampleSupplierType(i)); } // create mock for repository var mock = new Mock <ISupplierTypeRepository>(); mock.Setup(s => s.GetSupplierTypeListAdvancedSearch( Moq.It.IsAny <string>() // name , Moq.It.IsAny <string>() // description , Moq.It.IsAny <bool?>() // active )).Returns(list); // service SupplierTypeService supplierTypeService = new SupplierTypeService(); SupplierTypeService.Repository = mock.Object; // Act var resultList = supplierTypeService.GetSupplierTypeListAdvancedSearch( name , description , active ); SupplierTypeDTO result = resultList.FirstOrDefault(); // Assert Assert.IsNotNull(result); Assert.AreEqual(1, result.SupplierTypeId); }
public void DeleteSupplierTypeById_Success_Test() { // Arrange int id = 1; // create mock for repository var mock = new Mock <ISupplierTypeRepository>(); mock.Setup(s => s.DeleteSupplierType(Moq.It.IsAny <int>())).Verifiable(); // service SupplierTypeService supplierTypeService = new SupplierTypeService(); SupplierTypeService.Repository = mock.Object; // Act supplierTypeService.DeleteSupplierType(id); // Assert Assert.IsTrue(true); }
public void UpdateSupplierType_Success_Test() { // Arrange SupplierTypeDTO dto = SampleSupplierTypeDTO(1); // create mock for repository var mock = new Mock <ISupplierTypeRepository>(); mock.Setup(s => s.UpdateSupplierType(Moq.It.IsAny <R_SupplierType>())).Verifiable(); // service SupplierTypeService supplierTypeService = new SupplierTypeService(); SupplierTypeService.Repository = mock.Object; // Act supplierTypeService.UpdateSupplierType(dto); // Assert Assert.IsNotNull(dto); }
public void AddSupplierType_Success_Test() { // Arrange SupplierTypeDTO dto = SampleSupplierTypeDTO(1); // create mock for repository var mock = new Mock <ISupplierTypeRepository>(); mock.Setup(s => s.AddSupplierType(Moq.It.IsAny <R_SupplierType>())).Returns(1); // service SupplierTypeService supplierTypeService = new SupplierTypeService(); SupplierTypeService.Repository = mock.Object; // Act int id = supplierTypeService.AddSupplierType(dto); // Assert Assert.AreEqual(1, id); Assert.AreEqual(1, dto.SupplierTypeId); }
public void GetSupplierType_Success_Test() { // Arrange int id = 1; R_SupplierType supplierType = SampleSupplierType(id); // create mock for repository var mock = new Mock <ISupplierTypeRepository>(); mock.Setup(s => s.GetSupplierType(Moq.It.IsAny <int>())).Returns(supplierType); // service SupplierTypeService supplierTypeService = new SupplierTypeService(); SupplierTypeService.Repository = mock.Object; // Act SupplierTypeDTO result = supplierTypeService.GetSupplierType(id); // Assert Assert.IsNotNull(result); Assert.AreEqual(1, result.SupplierTypeId); }
/// <summary> /// 下拉列表框 /// </summary> /// <returns></returns> public static IQueryable GetSupplierType() { return(SupplierTypeService.GetSupplierType()); }