private static ADFilterSample BuildADFilter(GroupItemResolved resolvedGroup, string zone)
        {
            var adFilter = new ADFilterSample(zone);

            adFilter.RegisterResolvedGroupHandler(resolvedGroup);
            return(adFilter);
        }
Beispiel #2
0
        private static ADFilter FilterBuilder(GroupItemResolved resolvedGroup, ADZone zone)
        {
            var filter = new ADFilter(zone);

            filter.RegisterResolvedGroupHandler(resolvedGroup);
            return(filter);
        }
        public void WhenEnquedItemsFilterDeliveredTwiceMethodsAreCalled()
        {
            int handledItemsCount  = 0;
            int resolvedItemsCount = 0;

            PendingItemsHandled hpi = (count) =>
            {
                Interlocked.Increment(ref handledItemsCount);
            };
            GroupItemResolved rg = (resolvedGroupItem) =>
            {
                Interlocked.Increment(ref resolvedItemsCount);
            };
            var adf = new ADFilterPong();

            adf.RegisterResolvedGroupHandler(rg);
            var queryEngine = new QueryEngine(hpi, new ADFilterPong());

            queryEngine.Enque("a");
            queryEngine.Enque("b");
            while (Interlocked.CompareExchange(ref handledItemsCount, 2, 2) == 2)
            {
                System.Threading.Thread.Sleep(0);
            }

            queryEngine.Enque("c");
            while (Interlocked.CompareExchange(ref handledItemsCount, 3, 3) == 3)
            {
                System.Threading.Thread.Sleep(0);
            }

            queryEngine.Stop();
        }
        public void StartStop()
        {
            PendingItemsHandled hpi = (count) =>
            {
            };
            GroupItemResolved rg = (resolvedGroupItem) =>
            {
            };
            var adf = new ADFilterPong();

            adf.RegisterResolvedGroupHandler(rg);
            var queryEngine = new QueryEngine(hpi, new ADFilterPong());

            queryEngine.Stop();
        }
 public void RegisterResolvedGroupHandler(GroupItemResolved resolvedGroup)
 {
     _resolvedGroup = resolvedGroup;
 }
 public IEnumerable <IADFilter> TakeFilters(GroupItemResolved resolvedGroup)
 {
     return(Zones.Select(zone => BuildADFilter(resolvedGroup, zone)));
 }
 public IEnumerable <IADFilter> TakeFilters(GroupItemResolved resolvedGroup)
 {
     return(new IADFilter[0]);
 }