public void DeleteSelectionOnReadOnlyColumnDoesNothing() { var persons = new List<Person> {new Person {Name = "Aaltje",Age = 12 }, new Person {Name = "Berend",Age = 11 }}; var tableView = new TableView { Data = persons }; //select the top row tableView.SelectCells(0, 1, 0, 1); tableView.Columns[1].ReadOnly = true; //action! try to delete something tableView.DeleteCurrentSelection(); //assert all is well Assert.AreEqual(12, persons[0].Age); Assert.AreEqual(2, persons.Count); }
public void DeleteSelectionRemovesRowIfAllCellsInARowAreSelected() { var persons = new List<Person> {new Person {Name = "Aaltje",Age = 12}, new Person {Name = "Berend",Age = 11 }}; var tableView = new TableView { Data = persons }; //select the top row tableView.SelectCells(0, 0, 0, 1); //action! delete the row tableView.DeleteCurrentSelection(); //assert we only have berend now Assert.AreEqual(new[] { "Berend" }, persons.Select(p => p.Name).ToArray()); }
public void DeleteSelectionTakesAllowDeleteRowsIntoAccount() { var persons = new List<Person> {new Person {Name = "Aaltje",Age = 12 }, new Person {Name = "Berend",Age = 11 }}; var tableView = new TableView { Data = persons }; //select the top row tableView.SelectCells(0, 0, 0, 1); //action! delete the row tableView.AllowDeleteRow = false; tableView.DeleteCurrentSelection(); //assert aaltje got 'reset' Assert.AreEqual(new[] {"", "Berend" }, persons.Select(p => p.Name).ToArray()); Assert.AreEqual(new[] { 0, 11 }, persons.Select(p => p.Age).ToArray()); }
public void DeleteSelectionRemovesValueIfCellWasSelect() { var persons = new List<Person> {new Person {Name = "Aaltje",Age = 12 }, new Person {Name = "Berend",Age = 11 }}; var tableView = new TableView { Data = persons }; //select the twelve tableView.SelectCells(0, 1, 0, 1); //action! delete the row tableView.DeleteCurrentSelection(); //assert we 'deleted' the age Assert.AreEqual(0,persons[0].Age); }