Skip to content

Commit

Permalink
access elements with array style
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Miller committed Mar 10, 2024
1 parent bb44ff6 commit 55cc7e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Maui.DataGrid.Sample/Tests/ItemsSourceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void BindsItemSource()
public void BindsSelectedItem()
{
var datagrid = new DataGrid { ItemsSource = _teams };
datagrid.CheckPropertyBindingWorks(DataGrid.SelectedItemProperty, _teams.ElementAt(2), _teams.ElementAt(3));
datagrid.CheckPropertyBindingWorks(DataGrid.SelectedItemProperty, _teams[2], _teams[3]);
}

[Fact]
Expand All @@ -43,8 +43,8 @@ public async void SelectNonExistingItemNotPossible()

datagrid.SetBinding(DataGrid.SelectedItemProperty, new Binding("Item", source: viewModel));

viewModel.Item = _teams.First();
Assert.Equal(_teams.First(), await datagrid.GetValueSafe(DataGrid.SelectedItemProperty));
viewModel.Item = _teams[0];
Assert.Equal(_teams[0], await datagrid.GetValueSafe(DataGrid.SelectedItemProperty));

viewModel.Item = _dummyTeam;
Assert.Null(await datagrid.GetValueSafe(DataGrid.SelectedItemProperty));
Expand All @@ -61,7 +61,7 @@ public async void RemovingItemInObservableCollectionUpdatesItemsSource()
var itemsSource = await datagrid.GetValueSafe(DataGrid.ItemsSourceProperty) as ObservableCollection<Team>;
Assert.NotNull(itemsSource);
Assert.Equal(_teams.Count - 1, itemsSource!.Count);
Assert.DoesNotContain(_teams.ElementAt(2), itemsSource);
Assert.DoesNotContain(_teams[2], itemsSource);
}

[Fact]
Expand Down

0 comments on commit 55cc7e8

Please sign in to comment.