Example #1
0
        public void getuserstest()
        {
            Data.Entities.HLContext _db  = new Data.Entities.HLContext();
            Data.UserRepository     test = new Data.UserRepository(_db);
            string username1             = "Edwin";
            string password1             = "password";
            string username2             = "Push";
            string password2             = "Pinder";
            bool   expected = true;
            bool   actual   = false;

            Domain.User user1 = new Domain.User(username1, password1);
            Domain.User user2 = new Domain.User(username2, password2);
            test.AddUser(user1);
            test.AddUser(user2);
            test.Save();
            var Users = test.GetUsers();

            foreach (var User in Users)
            {
                actual = test.validateusername(User.username);
                if (actual == false)
                {
                    break;
                }
            }

            Assert.AreEqual(expected, actual);
            test.DeleteUser(user1);
            test.DeleteUser(user2);
            test.Save();
        }
Example #2
0
        public void savetest()
        {
            Data.Entities.HLContext _db  = new Data.Entities.HLContext();
            Data.UserRepository     test = new Data.UserRepository(_db);
            bool   expected = false;
            string username = "******";
            string password = "******";

            Domain.User user1 = new Domain.User();
            user1.UserFill(username, password);
            test.AddUser(user1);
            test.Save();
            int userid = 0;
            var Users  = test.GetUsers();

            foreach (var User in Users)
            {
                if (User.username == username)
                {
                    userid   = User.id;
                    expected = true;
                }
            }

            bool actual = test.validateusername(test.GetUserByUserid(userid).username);

            Assert.AreEqual(expected, actual);
            test.DeleteUser(test.GetUserByUserid(userid));
            test.Save();
        }
Example #3
0
        public void validateusernametest()
        {
            Data.Entities.HLContext _db  = new Data.Entities.HLContext();
            Data.UserRepository     test = new Data.UserRepository(_db);
            bool   expected = false;
            string username = "******";

            Domain.User user1 = new Domain.User();
            user1.UserFill("akash", "1234");
            test.AddUser(user1);
            test.Save();
            var Users = test.GetUsers();

            foreach (var User in Users)
            {
                if (User.username == username)
                {
                    expected = true;
                }
            }
            bool actual = test.validateusername(username);

            Assert.AreEqual(expected, actual);
            test.DeleteUser(user1);
            test.Save();
        }