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(); }
public void UpdateOnUserRepository() { //Arrange UserRepository userRepository = new UserRepository(_config); var userToUpdate = _users[1]; userToUpdate.Password = "******"; //Act userRepository.Update(userToUpdate); User user = userRepository.Get(userToUpdate.Id); //Assert Assert.AreEqual(user, userToUpdate); }