예제 #1
0
        public void GlobalSetup()
        {
            var random = new Random();

            _outer = new List <Entity>(Length);

            for (int i = 0; i < Length && _outer.Count < Length; i++)
            {
                int duplicatesCount = random.Next(_maxPropertyDuplicates) + 1;

                for (int j = 0; j < duplicatesCount && _outer.Count < Length; j++)
                {
                    _outer.Add(new Entity {
                        Property = i
                    });
                }
            }

            _outer.Shuffle();

            _list = new List <Entity>(Length);

            for (int i = 0; i < Length && _list.Count < Length; i++)
            {
                int duplicatesCount = random.Next(_maxPropertyDuplicates) + 1;

                for (int j = 0; j < duplicatesCount && _list.Count < Length; j++)
                {
                    _list.Add(new Entity {
                        Property = i
                    });
                }
                _maxProperty = i;
            }

            _list.Shuffle();

            _hashIndexed = _list.IndexBy(e => e.Property);

            _sortedIndexed = _list.IndexBy(e => e.Property, true);

            _lookup = _list.ToLookup(e => e.Property);

            _hashLookup = _hashIndexed.ToLookup(e => e.Property);

            _sortedLookup = _sortedIndexed.ToLookup(e => e.Property);
        }