public void CreateOnUserRepository() { //Arrange UserRepository userRepository = new UserRepository(_config); var userToCreate = new User { Username = "******", Password = "******" }; //Act Guid id = userRepository.Create(userToCreate); User user = userRepository.Get(id); //Assert Assert.AreEqual(user, userToCreate); Assert.IsNotNull(id); }
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(); }