/// <summary> /// Each test will start by testing for an empty table, and each test /// will leave the database state as it found it. /// </summary> private void TruncatePersonTable() { // We have to work with what we have :) peopleProvider = new PeopleProvider(); var people = peopleProvider.ListPeople(); people.ToList().ForEach(p => peopleProvider.DeletePerson(p.ID)); }
public void SQLite_DeletePerson_CheckEmpty() { TruncatePersonTable(); // Create one person var person = GetNewPerson("Joe", "Smith", 40); peopleProvider.CreatePerson(person); // Get ID var people = peopleProvider.ListPeople(); var ID = people.ToArray()[0].ID; // Delete peopleProvider.DeletePerson(ID); // Check all gone people = peopleProvider.ListPeople(); Assert.AreEqual(0, people.Count(), $"Expected an empty table after delete, but found {people.Count()} item(s)", null); TruncatePersonTable(); }