public void DeleteFromDatabase() { List <Applicant> applicantsToDelete = CrudManager .RetrieveAllApplications() .Where(a => a.Equals(ApplicantToTest) || a.Equals(ApplicantToTest_Edited)).ToList(); if (null != applicantsToDelete && applicantsToDelete.Count > 0) { foreach (Applicant a in applicantsToDelete) { if (null != a) { CrudManager.DeleteApplication(a); } } } }
public void CrudManagerCanDeleteValidEntry() { // Old int oldCount = CrudManager.RetrieveAllApplications().Count; // Current Applicant applicant = CreateApplication(); int currentCount = CrudManager.RetrieveAllApplications().Count; // Final CrudManager.DeleteApplication(applicant); List <Applicant> finalApplicants = CrudManager.RetrieveAllApplications(); int finalCount = finalApplicants.Count; // Assertions Assert.Less(oldCount, currentCount); Assert.Less(finalCount, currentCount); }