public void DeleteOnUserRepository() { //Arrange UserRepository userRepository = new UserRepository(_config); var userToDelete = _users[1]; //Act userRepository.Delete(userToDelete.Id); User user = userRepository.Get(userToDelete.Id); //Assert Assert.IsNull(user); }
static void Main(string[] args) { //PhonebookEntities phonebookEntities = new PhonebookEntities(Properties.Settings.Default.FilePaths, Properties.Settings.Default.UserFile); //Console.WriteLine(); //UserRepository userRepository = new UserRepository(); //userRepository.Create(new User {Password = "******", Username = "******"}); //userRepository.Create(new User { Password = "******", Username = "******" }); //userRepository.Dispose(); UserRepository userRepository = new UserRepository(); List<User> users = userRepository.GetAll().ToList(); User userToUpdate = userRepository.Get(users[0].Id); userToUpdate.Username = "******"; userRepository.Update(userToUpdate); userRepository.Create(new User { Password = "******", Username = "******" }); List<User> users2 = userRepository.GetAll().ToList(); foreach (var user in users2) { Console.WriteLine("Username: "******", Password: " + user.Password); } userRepository.Delete(users2[2].Id); userRepository.Dispose(); Console.ReadLine(); }