public void TestAdd1()
        {
            User        user = new User("Adam", "Nowak", "anowak", "Hasło1");
            List <User> list = new List <User>();

            list.Add(user);
            UserLocalDataBase uldb = new UserLocalDataBase();

            uldb.Add(user);
            CollectionAssert.AreEqual(list, uldb.ReturnList());
        }
 /// <summary>
 /// Konstruktor strony administratora.
 /// </summary>
 public AdminPage()
 {
     UserLocalDataBase = UserLocalDataBase.Initialize();
     FirmLocalDataBase = FirmLocalDataBase.Initialize();
     ReporterList      = Reporter.Load();
     InitializeComponent();
     UsersView.AutoGenerateColumns = false;
     UsersView.ItemsSource         = UserLocalDataBase.ReturnList();
     FirmView.ItemsSource          = FirmLocalDataBase.ReturnList();
     ReportView.ItemsSource        = ReporterList.ReturnList();
 }
        public void TestAdd2()
        {
            User        user1 = new User("Adam", "Nowak", "anowak", "Hasło1");
            User        user2 = new User("Maria", "Kowalska", "mkowalska", "Hasło2");
            List <User> list  = new List <User>();

            list.Add(user1);
            list.Add(user2);
            UserLocalDataBase uldb = new UserLocalDataBase();

            uldb.Add(user1);
            CollectionAssert.AreNotEqual(list, uldb.ReturnList());
        }
        public void TestChangePasswordTest1()
        {
            User        user1 = new User("Adam", "Nowak", "anowak", "Hasło1");
            User        user2 = new User("Maria", "Kowalska", "mkowalska", "Hasło2");
            List <User> list  = new List <User>();

            list.Add(user1);
            list.Add(user2);
            UserLocalDataBase uldb = new UserLocalDataBase();

            uldb.Add(user1);
            uldb.Add(user2);

            string login       = "******";
            string newPassword = "******";
            string changed     = "";

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].login == login)
                {
                    list[i].password = newPassword;
                    changed          = newPassword;
                }
            }

            string result = "";

            uldb.ChangePassword(login, newPassword);
            foreach (User u in uldb.ReturnList())
            {
                if (u.login == login)
                {
                    result = u.password;
                }
            }

            Assert.AreEqual(changed, result);
        }
 public void RefreshUsersView()
 {
     UserLocalDataBase     = UserLocalDataBase.Initialize();
     UsersView.ItemsSource = UserLocalDataBase.ReturnList();
 }