public void CreateDerivedList_Handles_RemoveRange()
        {
            var source = new AvaloniaList <int>(new[] { 0, 1, 2, 3 });
            var target = source.CreateDerivedList(x => new Wrapper(x));

            source.RemoveRange(1, 2);

            var result = target.Select(x => x.Value).ToList();

            Assert.Equal(source, result);
        }
Пример #2
0
        public void Can_Decrease_Number_Of_Materialized_Items_By_Removing_From_Source_Collection()
        {
            var items  = new AvaloniaList <string>(Enumerable.Range(0, 20).Select(x => $"Item {x}"));
            var target = new ListBox
            {
                Template     = ListBoxTemplate(),
                Items        = items,
                ItemTemplate = new FuncDataTemplate <string>((x, _) => new TextBlock {
                    Height = 10
                })
            };

            Prepare(target);
            target.Scroll.Offset = new Vector(0, 1);

            items.RemoveRange(0, 11);
        }