Exemple #1
0
        public void RandomlyChangeIndex()
        {
            RandomGenerator.ResetRandomGenerator();

            var list = new ObservableList <int>();

            foreach (var value in Enumerable.Range(0, 100))
            {
                list.Add(list.Count, RandomGenerator.GenerateRandomInteger());
            }

            var index = new ActiveValue <int>();

            var sut = list.ActiveElementAtOrDefault(index);

            foreach (var value in Enumerable.Range(0, 100))
            {
                index.Value = RandomGenerator.GenerateRandomInteger(-10, 110);

                Assert.Equal(sut.Value, list.ElementAtOrDefault(index.Value));
            }
        }