public void TestNewAndGetUser()
        {
            adapterHarness.Add(user);
            User actual = adapterHarness.GetById(user.Id);

            Assert.AreEqual(user.Id, actual.Id);
        }
        public void TestAddAndGetByID()
        {
            adapterHarness.Add(newUser);
            User actual = adapterHarness.GetById(newUser.Id);

            Assert.AreEqual(newUser.Id, actual.Id);
        }
示例#3
0
        public void TestAddAndGetUser()
        {
            _user.RegisterDTTM  = DateTime.Now;
            _user.LastLoginDTTM = DateTime.Now;
            //Act
            _harness.Add(_user);
            User actual = _harness.GetById(_user.Id);

            //Assert
            Assert.AreEqual(_user.Id, actual.Id);
        }
 public void AddNewUser(string email)
 {
     try {
         _adapter.Add(CreateUser(email));
     } catch (Exception ex) {
         throw new Exception(ex.ToString());
     }
 }
 public void AddNewUser(string email)
 {
     try {
         _adapter.Add(CreateUser(email));
     } catch (System.Data.DuplicateNameException dne) {
         throw new System.Data.DuplicateNameException(dne.Message);
     } catch (Exception e) {
         throw new Exception(e.ToString());
     }
 }
 public void AddNewUser(string email)
 {
     try
     {
         userAdapter.Add(CreateUser(email));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         throw new Exception(e.ToString());
     }
 }
示例#7
0
        public void TestAddAndGetUser()
        {
            //Arrange
            User user = new User("*****@*****.**");

            user.RegisterDTTM  = DateTime.Now;
            user.LastLoginDTTM = DateTime.Now;
            Console.WriteLine(user.Id.ToString());
            //Act
            _harness.Add(user);
            User actual = _harness.GetById(user.Id);

            //Assert
            Assert.AreEqual(user.Id, actual.Id);
        }
示例#8
0
        public void TestAddAndGetUser()
        {
            UserAdapter _harness1 = new UserAdapter(new MySqlUser());
            User        _user     = new User("*****@*****.**");

            //Arrange
            _user.RegisterDTTM  = DateTime.Now;
            _user.LastLoginDTTM = DateTime.Now;
            //Act
            _harness1.Add(_user);
            User actual = _harness1.GetById(_user.Id);

            //Assert
            Assert.AreEqual(_user.Id, actual.Id);
            _harness1.Remove(_user);
        }
示例#9
0
        public void TestAddAndGetAll()
        {
            UserAdapter _harness2 = new UserAdapter(new MySqlUser());
            User        _user     = new User("*****@*****.**");

            //Arrange
            _user.RegisterDTTM  = DateTime.Now;
            _user.LastLoginDTTM = DateTime.Now;
            _harness2.Add(_user);
            //Act
            ArrayList users  = (ArrayList)_harness2.GetAll();
            User      actual = (User)users[users.Count - 1];

            //Assert
            Assert.AreEqual(_user.Id.ToString(), actual.Id.ToString());
            _harness2.Remove(_user);
        }
        public void UpdateUserTest()
        {
            UserAdapter harness = new UserAdapter(new MySqlUser());

            User test = new User("*****@*****.**");

            harness.Add(test);
            string email = "*****@*****.**";

            test.ChangeEmail(email);
            harness.Update(test);

            User expected = harness.GetByEmail("*****@*****.**");
            User actual   = harness.GetById(test.Id);

            //var actual = Assert.ThrowsException<UserAdapterNotFoundException>(() => _harness.Remove(_user));

            Assert.AreEqual(expected.Email, actual.Email);
        }
示例#11
0
        public void TearDown()
        {
            User user = new User(_email);

            _harness.Remove(user);
            _harness.Remove(testUser);
            if (removeAll == true)
            {
                removeAll = false;
                for (int i = 0; i < allUsers.Count; i++)
                {
                    _harness.Add((User)allUsers[i]);
                }
            }
        }
示例#12
0
        public void AddUser()
        {
            bool accepted = false;
            User user     = new User();

            _harness.Add(user);
            IEnumerable users = _harness.GetAll();
            ArrayList   list  = new ArrayList();

            foreach (var item in users)
            {
                list.Add(item);
            }
            if (list.Count == 1)
            {
                accepted = true;
            }
            Assert.AreEqual(true, accepted);
        }