コード例 #1
0
        public void ShouldReturnFalseIfCollectionsAreNotStrictelyIdentical()
        {
            List <int> a, b, c;

            a = new List <int>();
            a.Add(1);
            a.Add(2);
            a.Add(3);
            b = new List <int>();
            b.Add(3);
            b.Add(1);
            b.Add(2);


            Assert.IsFalse(CollectionProcessor.IsStrictelyIndenticalToEx(a, b));

            a = new List <int>();
            a.Add(1);
            a.Add(2);
            a.Add(3);
            b = new List <int>();
            b.Add(4);
            b.Add(1);
            b.Add(2);
            c = new List <int>();
            c.Add(1);
            c.Add(2);


            Assert.IsFalse(CollectionProcessor.IsStrictelyIndenticalToEx(a, b));
            Assert.IsFalse(CollectionProcessor.IsStrictelyIndenticalToEx(a, c));
            Assert.IsFalse(CollectionProcessor.IsStrictelyIndenticalToEx(a, null));
            Assert.IsFalse(CollectionProcessor.IsStrictelyIndenticalToEx(null, a));
        }
コード例 #2
0
        public void ShouldNotReturnDistinct()
        {
            int[] items;

            items = CollectionProcessor.DistinctEx <int>(null).ToArray();
            Assert.AreEqual(0, items.Length);
        }
コード例 #3
0
        public void ShouldReturnDistinct()
        {
            List <int> a;

            int[] items;

            a = new List <int>();
            a.Add(1);
            a.Add(2);
            a.Add(3);
            items = CollectionProcessor.DistinctEx(a).ToArray();
            Assert.AreEqual(3, items.Length);
            Assert.AreEqual(1, items[0]);
            Assert.AreEqual(2, items[1]);
            Assert.AreEqual(3, items[2]);
            a.Add(1);
            a.Add(2);
            a.Add(3);
            a.Add(1);
            items = CollectionProcessor.DistinctEx(a).ToArray();
            Assert.AreEqual(3, items.Length);
            Assert.AreEqual(1, items[0]);
            Assert.AreEqual(2, items[1]);
            Assert.AreEqual(3, items[2]);
        }
コード例 #4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="FrontServiceClient" /> class.
 /// </summary>
 public FrontServiceClient()
 {
     /*
      *  For future extensibility
      *  ProcessorContext.ProcessorManager = ProcessorManagerFactory.Create();
      *  ServiceContext.HubConfigurator = new HubConfigurator(ProcessorContext.ProcessorManager);
      */
     this.collectionProcessor       = new CollectionProcessor();
     this.reportProcessor           = new ReportProcessor();
     this.systemEnterProcessor      = new SystemEnterProcessor();
     this.systemConnectionProcessor = new SystemConnectProcessor();
 }
コード例 #5
0
        public void ShouldReturnFalseIfDoesntContainItems()
        {
            List <int> a;

            a = new List <int>();
            a.Add(1);
            a.Add(2);
            a.Add(3);

            Assert.IsFalse(CollectionProcessor.ContainsEx(a, 4));
            Assert.IsFalse(CollectionProcessor.ContainsEx(a, -1));
            Assert.IsFalse(CollectionProcessor.ContainsEx(null, 1));
        }
コード例 #6
0
        public void ShouldReturnTrueIfContainsItems()
        {
            List <int> a;

            a = new List <int>();
            a.Add(1);
            a.Add(2);
            a.Add(3);

            Assert.IsTrue(CollectionProcessor.ContainsEx(a, 1));
            Assert.IsTrue(CollectionProcessor.ContainsEx(a, 2));
            Assert.IsTrue(CollectionProcessor.ContainsEx(a, 3));
        }
コード例 #7
0
        public void ShouldReturnTrueIfCollectionsAreIdentical()
        {
            List <int> a, b;

            a = new List <int>();
            a.Add(1);
            a.Add(2);
            a.Add(3);
            b = new List <int>();
            b.Add(3);
            b.Add(1);
            b.Add(2);


            Assert.IsTrue(CollectionProcessor.IsIndenticalToEx(a, b));
        }
コード例 #8
0
 private void GetHtmlList(object arg)
 {
     try
     {
         string content = CollectionProcessor.GetWebContent(arg.ToString());
         webs = CollectionProcessor.GetWebListByListPageContent(content, host, beginString, endString, false, maxWebCount, distinct);
     }
     catch (Exception e)
     {
         throw new Exception("GetHtmlList:" + e.Message);
     }
     finally
     {
         OnCollectDirectoryFinished();
     }
 }
コード例 #9
0
 public void StopCollecting()
 {
     CollectionProcessor.StopCollecting();
 }
コード例 #10
0
        public async Task <IActionResult> Index(
            Guid id,
            string sortOrder,
            string currentFilter,
            string searchString,
            ushort minValue,
            ushort maxValue,
            double[] sizeValues      = default,
            string currentSizeValues = default,
            ProductItemType[] productItemTypeValues = default,
            string currentproductItemTypeValues     = default,
            string[] colorValues      = default,
            string currentColorValues = default,
            ushort pageIndex          = 0)
        {
            if (id != default)
            {
                ProductItem productItem = dataManager.ProductItems.GetProductById(id);

                ViewBag.PageTitle = productItem;

                IQueryable <ProductItem> productItems = dataManager.ProductItems.GetProducts();
                return(View("Show", await ShowViewModel.CreateAsync(productItem, productItems.AsNoTracking())));
            }

            ViewBag.PageTitle = dataManager.Pages.GetPageTitleByCodeWord("PageCatalog");

            if (searchString != null)
            {
                pageIndex = 0;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewData["CurrentSort"] = sortOrder;


            Dictionary <double, bool> sizes = dataManager.Sizes.GetSizes().Select(p => p.SizeValue).Distinct().OrderBy(p => p).ToDictionary(k => k, v => false);

            Dictionary <ProductItemType, bool> productItemTypes = dataManager.ProductItems.GetProducts().Select(p => p.ProductItemType).Distinct().OrderBy(p => p).ToDictionary(k => k, v => false);

            Dictionary <string, bool> colors = dataManager.ProductItems.GetProducts().Select(p => p.Color).Distinct().OrderBy(p => p).ToDictionary(k => k, v => false);

            var products = dataManager.ProductItems.GetProducts().Select(p => p);

            return(View(await CatalogViewModel.CreateAsync
                        (
                            new ViewFilter <ProductItem>
                            (
                                searchString,
                                minValue,
                                maxValue,
                                CollectionProcessor.GetSelectedProductItemTypeValues(
                                    productItemTypes,
                                    productItemTypeValues,
                                    currentproductItemTypeValues),
                                CollectionProcessor.GetSelectedSizeValues(
                                    sizes,
                                    sizeValues,
                                    currentSizeValues),
                                CollectionProcessor.GetSelectedColorValues(
                                    colors,
                                    colorValues,
                                    currentColorValues)
                            ),
                            products.AsNoTracking(),
                            pageIndex,
                            sortOrder
                        )));
        }