/// <summary> /// Delete the test data /// </summary> private static void DeleteTestData() { var rockContext = new RockContext(); var stepProgramService = new StepProgramService(rockContext); var stepProgramQuery = stepProgramService.Queryable().Where(sp => sp.ForeignKey == ForeignKey); stepProgramService.DeleteRange(stepProgramQuery); rockContext.SaveChanges(); var dataViewFilterService = new DataViewFilterService(rockContext); var dvfQuery = dataViewFilterService.Queryable().Where(dvf => dvf.DataView.ForeignKey == ForeignKey || dvf.ForeignKey == ForeignKey); dataViewFilterService.DeleteRange(dvfQuery); rockContext.SaveChanges(); var dataViewService = new DataViewService(rockContext); var dvQuery = dataViewService.Queryable().Where(dv => dv.ForeignKey == ForeignKey); dataViewService.DeleteRange(dvQuery); rockContext.SaveChanges(); var personSearchKeyService = new PersonSearchKeyService(rockContext); var personSearchKeyQuery = personSearchKeyService.Queryable().Where(psk => psk.PersonAlias.Person.ForeignKey == ForeignKey); personSearchKeyService.DeleteRange(personSearchKeyQuery); var personAliasService = new PersonAliasService(rockContext); var personAliasQuery = personAliasService.Queryable().Where(pa => pa.Person.ForeignKey == ForeignKey || pa.ForeignKey == ForeignKey); personAliasService.DeleteRange(personAliasQuery); rockContext.SaveChanges(); var personService = new PersonService(rockContext); var personQuery = personService.Queryable().Where(p => p.ForeignKey == ForeignKey); personService.DeleteRange(personQuery); rockContext.SaveChanges(); }