public void ReturnsCorrectIndex()
            {
                var index = mockCollection.IndexOf(itemId: 2);

                var expected = new SectionedIndex(1, 2);

                index.Should().Be(expected);
            }
        private bool remove(SectionedIndex index)
        {
            if (dataSource.SectionContainsOnlyOneRow(index.Section))
            {
                tableView.DeleteSections(indexSet(index.Section), UITableViewRowAnimation.Automatic);
                return(true);
            }

            tableView.DeleteRows(index.ToIndexPaths(), UITableViewRowAnimation.Automatic);
            return(false);
        }
 private void remove(SectionedIndex index)
 {
     if (displayedItems[index.Section].Count == 1)
     {
         displayedItems.RemoveAt(index.Section);
     }
     else
     {
         displayedItems[index.Section].RemoveAt(index.Row);
     }
 }
예제 #4
0
 public MoveRowWithinExistingSectionsCollectionChange(
     SectionedIndex oldIndex,
     SectionedIndex index,
     T item,
     bool moveToDifferentSection)
 {
     OldIndex = oldIndex;
     Index    = index;
     Item     = item;
     MoveToDifferentSection = moveToDifferentSection;
 }
            public void ReturnsCorrectItem()
            {
                List <int> list = new List <int> {
                    40, 70, 8, 3, 1, 2
                };

                intCollection.ReplaceWith(list);

                var expected = new SectionedIndex(1, 0);

                intCollection.RemoveItemAt(1, 0).Should().Be(40);
            }
            public void ReturnsCorrectSectionIndex()
            {
                List <int> list = new List <int> {
                    40, 70, 8, 3, 1, 2
                };

                intCollection.ReplaceWith(list);

                var expected = new SectionedIndex(0, 3);

                intCollection.InsertItem(4).index.Should().Be(expected);
            }
예제 #7
0
        private bool remove(SectionedIndex index)
        {
            var rowIsTheLastOneInTheSection = tableView.NumberOfRowsInSection(index.Section) == 1;

            if (rowIsTheLastOneInTheSection)
            {
                tableView.DeleteSections(indexSet(index.Section), UITableViewRowAnimation.Automatic);
                return(true);
            }

            tableView.DeleteRows(index.ToIndexPaths(), UITableViewRowAnimation.Automatic);
            return(false);
        }
            public void ReturnsCorrectIndex()
            {
                List <int> list = new List <int> {
                    40, 70, 8, 3, 1, 2
                };

                intCollection.ReplaceWith(list);

                var index = intCollection.IndexOf(70);

                var expected = new SectionedIndex(1, 1);

                index.Should().Be(expected);
            }
 public MoveRowToNewSectionCollectionChange(SectionedIndex oldIndex, int index, T item)
 {
     OldIndex = oldIndex;
     Index    = index;
     Item     = item;
 }
 public void UpdateRow(SectionedIndex index, TModel item)
 {
     changesList.Add(new UpdateRowCollectionChange <TModel>(index, item));
 }
예제 #11
0
 public static NSIndexPath[] ToIndexPaths(this SectionedIndex index)
 => new[] { index.ToIndexPath() };
 private int mapSectionIndexToAdapterIndex(SectionedIndex sectionedIndex)
 {
     return(sectionsIndexes[sectionedIndex.Section] + sectionedIndex.Row + 1 + HeaderOffset);
 }
예제 #13
0
 public AddRowCollectionChange(SectionedIndex index, T item)
 {
     Index = index;
     Item  = item;
 }
 public void MoveRowToNewSection(SectionedIndex oldIndex, int index, TModel item)
 {
     changesList.Add(new MoveRowToNewSectionCollectionChange <TModel>(oldIndex, index, item));
 }
 public void MoveRowWithinExistingSections(SectionedIndex oldIndex, SectionedIndex index, TModel item, bool moveToDifferentSection)
 {
     changesList.Add(new MoveRowWithinExistingSectionsCollectionChange <TModel>(oldIndex, index, item, moveToDifferentSection));
 }
 private void add(SectionedIndex index, TModel item)
 {
     displayedItems[index.Section].Insert(index.Row, item);
 }
 public FlattenedItemInfo(int viewType, SectionedIndex sectionedIndex)
 {
     ViewType       = viewType;
     SectionedIndex = sectionedIndex;
 }
 private void update(SectionedIndex index, TModel item)
 {
     displayedItems[index.Section][index.Row] = item;
 }
 public RemoveRowCollectionChange(SectionedIndex index)
 {
     Index = index;
 }
예제 #20
0
 public static NSIndexPath ToIndexPath(this SectionedIndex index)
 => NSIndexPath.FromRowSection(index.Row, index.Section);
 public void RemoveRow(SectionedIndex index)
 {
     changesList.Add(new RemoveRowCollectionChange(index));
 }