public void GetAllOnUserRepository()
        {
            //Arrange
            UserRepository userRepository = new UserRepository(_config);

            //Act
            List<User> users = userRepository.GetAll().ToList();

            //Assert
            CollectionAssert.AreEqual(_users, users);
        }
示例#2
0
        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();
        }