public void ProcessManagerProductSearchAll()
 {
     DTOContext _DTOC = new DTOContext();
     ProcessManager _ProcessManager = new ProcessManager(_DTOC);
     ProductSearchParameters _ProductSearchParameters = new ProductSearchParameters();
     List<Product> products = _ProcessManager.ProductSearch(_ProductSearchParameters);
     Assert.AreEqual(products.Count(), _DTOC.Products.Count());
 }
 public void ProcessManagerProductSearchColours()
 {
     DTOContext _DTOC = new DTOContext();
     ProcessManager _ProcessManager = new ProcessManager(_DTOC);
     ProductSearchParameters _ProductSearchParameters = new ProductSearchParameters { ColourIds = new List<int>(new int[] { 1, 2, 3 }) };
     List<Product> products = _ProcessManager.ProductSearch(_ProductSearchParameters);
     Assert.IsTrue(products.Count() < _DTOC.Products.Count());
 }
        public ActionResult Index(string searchString , int SizeID = -1, int BrandID = -1, int ColourID = -1, int CustomerID = -1)
        {
            ProductSearchParameters _Params = new ProductSearchParameters();

            if (SizeID != -1)
            {
                _Params.SizeIds.Add(SizeID);
            }

            if (BrandID != -1)
            {
                _Params.BrandIds.Add(BrandID);
            }

            if (ColourID != -1)
            {
                _Params.ColourIds.Add(ColourID);
            }

            if (searchString.Length > 0)
            {
                _Params.SearchString = searchString;
            }

            ProductSearchModel _ProductViewModel = new ProductSearchModel
            {
                Sizes = processManager.GetSizes().Select(x => new SelectListItem
                {
                    Value = x.SizeId.ToString(),
                    Text = x.SizeName
                }),
                Brands = processManager.GetBrands().Select(x => new SelectListItem
                {
                    Value = x.BrandId.ToString(),
                    Text = x.BrandName
                }),
                Colours = processManager.GetColours().Select(x => new SelectListItem
                {
                    Value = x.ColourId.ToString(),
                    Text = x.ColourName
                }),
                Customers = processManager.GetCustomers().Select(x => new SelectListItem
               {
                   Value = x.CustomerId.ToString(),
                   Text = x.CustomerName
               })
            };

            if (CustomerID != -1)
            {
                _ProductViewModel.Products = processManager.CustomerProductSearch(CustomerID, _Params);
            }
            else
            {
                _ProductViewModel.Products = processManager.ProductSearch(_Params);
            }
            return View(_ProductViewModel);
        }
 public void ProcessManagerCustomerSearch()
 {
     DTOContext _DTOC = new DTOContext();
     ProcessManager _ProcessManager = new ProcessManager(_DTOC);
     ProductSearchParameters _ProductSearchParameters = new ProductSearchParameters { ColourIds = new List<int>(new int[] { 1, 2, 3 }) };
     Customer _Customer = _DTOC.Customers.Where(i => i.CustomerId == 3).FirstOrDefault();
     List<Product> products = _ProcessManager.CustomerProductSearch(_Customer.CustomerId, _ProductSearchParameters);
     Assert.IsTrue(products.Count() < _DTOC.Products.Count());
 }
 public void ProcessManagerStringSearch()
 {
     DTOContext _DTOC = new DTOContext();
     ProcessManager _ProcessManager = new ProcessManager(_DTOC);
     ProductSearchParameters _ProductSearchParameters = new ProductSearchParameters { SearchString = "Tee Nike" };
     List<Product> products = _ProcessManager.ProductSearch (_ProductSearchParameters);
     Assert.IsTrue(products.Count() < _DTOC.Products.Count());
 }