/// <summary> /// <see cref="Microsoft.Samples.NLayerApp.Application.MainModule.SalesManagement.ISalesManagementService"/> /// </summary> /// <param name="publisherName"><see cref="Microsoft.Samples.NLayerApp.Application.MainModule.SalesManagement.ISalesManagementService"/></param> /// <param name="description"><see cref="Microsoft.Samples.NLayerApp.Application.MainModule.SalesManagement.ISalesManagementService"/></param> /// <returns><see cref="Microsoft.Samples.NLayerApp.Application.MainModule.SalesManagement.ISalesManagementService"/></returns> public List <Product> FindProductBySpecification(string publisherName, string description) { //Create specification ProductInformationSpecification specification = new ProductInformationSpecification(publisherName, description); //query repository return(_productRepository.GetBySpec(specification as ISpecification <Product>) .ToList()); }
public void FindProductByProductInformation_Invoke_Test() { //Arrange IMainModuleUnitOfWork context = this.GetUnitOfWork(); ITraceManager traceManager = this.GetTraceManager(); ProductRepository repository = new ProductRepository(context, traceManager); string publisher = "Krasis Press"; string description = null; ProductInformationSpecification specification = new ProductInformationSpecification(publisher, description); //Act IEnumerable <Product> result = repository.GetBySpec(specification); //Assert Assert.IsNotNull(result); Assert.IsTrue(result.Count() > 0); }
/// <summary> /// <see cref="Microsoft.Samples.NLayerApp.Application.MainModule.SalesManagement.ISalesManagementService"/> /// </summary> /// <param name="publisherName"><see cref="Microsoft.Samples.NLayerApp.Application.MainModule.SalesManagement.ISalesManagementService"/></param> /// <param name="description"><see cref="Microsoft.Samples.NLayerApp.Application.MainModule.SalesManagement.ISalesManagementService"/></param> /// <returns><see cref="Microsoft.Samples.NLayerApp.Application.MainModule.SalesManagement.ISalesManagementService"/></returns> public List<Product> FindProductBySpecification(string publisherName, string description) { //Create specification ProductInformationSpecification specification = new ProductInformationSpecification(publisherName, description); //query repository return _productRepository.GetBySpec(specification as ISpecification<Product>) .ToList(); }