public void CanRemoveItemsStartingInRealizedRange() { RunOnUIThread.Execute(() => { var dataSource = new CustomItemsSource(Enumerable.Range(0, 10).ToList()); var repeater = SetupRepeater(dataSource); var realized = VerifyRealizedRange(repeater, dataSource); Verify.AreEqual(3, realized); Log.Comment("Remove in realized range: start:(1)InView end:(3)InView."); dataSource.Remove(index: 1, count: 3, reset: false); repeater.UpdateLayout(); realized = VerifyRealizedRange(repeater, dataSource); Verify.AreEqual(3, realized); Log.Comment("Remove in realized range: start:(1)InView end:(6)InView."); dataSource.Remove(index: 1, count: 6, reset: false); repeater.UpdateLayout(); realized = VerifyRealizedRange(repeater, dataSource); Verify.AreEqual(1, realized); }); }
public void CanRemoveAndInsertItemsInRealizedRange() { RunOnUIThread.Execute(() => { var dataSource = new CustomItemsSource(Enumerable.Range(0, 3).ToList()); var repeater = SetupRepeater(dataSource); var realized = VerifyRealizedRange(repeater, dataSource); Verify.AreEqual(3, realized); Log.Comment("Remove index 1 in realized range"); dataSource.Remove(index: 1, count: 1, reset: false); repeater.UpdateLayout(); realized = VerifyRealizedRange(repeater, dataSource); Verify.AreEqual(2, realized); Log.Comment("Add 5 items at index 1"); dataSource.Insert(index: 1, count: 5, reset: false); repeater.UpdateLayout(); realized = VerifyRealizedRange(repeater, dataSource); Verify.AreEqual(3, realized); }); }