public void It_deletes_a_client() { var result = 0; List <IdentityUser> users; // emulates the delete function in ClientStore using (var transaction = _database.GetTransaction()) { var clientToDelete = _clientTable.GetClientByName(client); result = _clientTable.Delete(clientToDelete); var clientUsers = _clientTable.GetClientUsers(clientToDelete.Id).ToList(); foreach (var clientUser in clientUsers) { _userTable.Delete(clientUser); } users = _clientTable.GetClientUsers(clientToDelete.Id).ToList(); transaction.Dispose(); } Assert.AreEqual(1, result); Assert.IsFalse(users.Any()); }