protected override void OnReset(IReadOnlyList<TSource> newItems)
		{
			_values.Clear();

			var newCount = 0;
			for (int i = 0; i < newItems.Count; ++i)
			{
				if (_predicate.Invoke(newItems[i]))
				{
					_values.Add(true);
					++newCount;
				}
				else
					_values.Add(false);
			}

			Value = newCount;
		}
Beispiel #2
0
        public void RandomlyAddItems()
        {
            RandomGenerator.ResetRandomGenerator();

            var list = new List <bool>();
            var sut  = new BooleanList();

            foreach (var value in Enumerable.Range(0, MaxCount))
            {
                var newValue = RandomGenerator.GenerateRandomInteger(0, 2) == 0;
                list.Add(newValue);
                sut.Add(newValue);
                ValidateLists(list, sut);
            }
        }
Beispiel #3
0
        private void CreateAndFillLists(out IList <bool> listOne, out IList <bool> listTwo)
        {
            var list = new List <bool>();
            var sut  = new BooleanList();

            for (int i = 0; i < MaxCount; ++i)
            {
                var newValue = RandomGenerator.GenerateRandomInteger(0, 2) == 0;
                list.Add(newValue);
                sut.Add(newValue);
            }

            listOne = list;
            listTwo = sut;
        }