public void FindProductsInPageMaterializeResults() { //Arrange var customerRepository = new SICustomerRepository(); var productRepository = new SIProductRepository(); var orderRepository = new SIOrderRepository(); productRepository.GetPagedInt32Int32ExpressionOfFuncOfProductKPropertyBoolean <string>((index, count, order, ascending) => { var book = new Book("title", "description", "publisher", "isbn"); book.ChangeUnitPrice(10M); book.GenerateNewIdentity(); var software = new Software("title", "description", "license code"); software.ChangeUnitPrice(10); software.GenerateNewIdentity(); return(new List <Product>() { book, software }); }); var salesManagement = new SalesAppService(productRepository, orderRepository, customerRepository); //act var result = salesManagement.FindProducts(0, 2); //Assert Assert.IsNotNull(result); Assert.IsTrue(result.Count == 2); }
public void FindProductsInPageReturnNullWhenNoData() { //Arrange var customerRepository = new SICustomerRepository(); var orderRepository = new SIOrderRepository(); var productRepository = new SIProductRepository(); productRepository.GetPagedInt32Int32ExpressionOfFuncOfProductKPropertyBoolean <string>((index, count, order, ascending) => { return(new List <Product>()); }); var salesManagement = new SalesAppService(productRepository, orderRepository, customerRepository); //act var result = salesManagement.FindProducts(0, 1); //Assert Assert.IsNull(result); }
public void FindProductsInPageReturnNullWhenNoData() { //Arrange var customerRepository = new SICustomerRepository(); var orderRepository = new SIOrderRepository(); var productRepository = new SIProductRepository(); productRepository.GetPagedInt32Int32ExpressionOfFuncOfProductKPropertyBoolean<string>((index, count, order, ascending) => { return new List<Product>(); }); var salesManagement = new SalesAppService(productRepository, orderRepository, customerRepository); //act var result = salesManagement.FindProducts(0, 1); //Assert Assert.IsNull(result); }
public void FindProductsInPageMaterializeResults() { //Arrange var customerRepository = new SICustomerRepository(); var productRepository = new SIProductRepository(); var orderRepository = new SIOrderRepository(); productRepository.GetPagedInt32Int32ExpressionOfFuncOfProductKPropertyBoolean<string>((index, count, order, ascending) => { var book = new Book("title", "description","publisher","isbn"); book.ChangeUnitPrice(10M); book.GenerateNewIdentity(); var software = new Software("title", "description","license code"); software.ChangeUnitPrice(10); software.GenerateNewIdentity(); return new List<Product>() { book, software }; }); var salesManagement = new SalesAppService(productRepository, orderRepository, customerRepository); //act var result = salesManagement.FindProducts(0, 2); //Assert Assert.IsNotNull(result); Assert.IsTrue(result.Count == 2); }
public void FindProductsInPageMaterializeResults() { //Arrange var adapter = PrepareTypeAdapter(); var customerRepository = new SICustomerRepository(); var productRepository = new SIProductRepository(); var orderRepository = new SIOrderRepository(); productRepository.GetPagedInt32Int32ExpressionOfFuncOfProductKPropertyBoolean<string>((index, count, order, ascending) => { return new List<Product>() { new Book(){Id= Guid.NewGuid(),Title = "title",UnitPrice = 10,Description ="description",ISBN ="isbn",Publisher ="publisher"}, new Software(){Id= Guid.NewGuid(),Title = "title",UnitPrice = 10,Description ="description",LicenseCode ="license code"}, }; }); var salesManagement = new SalesAppService(adapter, productRepository, orderRepository,customerRepository); //act var result = salesManagement.FindProducts(0, 2); //Assert Assert.IsNotNull(result); Assert.IsTrue(result.Count == 2); }