Beispiel #1
0
        public void AddUser()
        {
            //arrange
            User user = new User
            {
                FirstName = "Adam",
                LastName  = "Freeman",
                Email     = "*****@*****.**",
                IsActive  = true
            };
            EFRepository repository = new EFRepository();

            //act
            user = repository.AddUser(user);
            //asert
            Assert.IsNotNull(user);
        }
Beispiel #2
0
        public void UpdateUser()
        {
            //arrange
            EFRepository repository  = new EFRepository();
            var          userList    = repository.GetUsers();
            Random       x           = new Random();
            int          randomIndex = x.Next(userList.Count);
            var          user        = userList.ElementAt(randomIndex);

            user.FirstName = "Test1";
            user.LastName  = "Test2";
            user.Email     = "*****@*****.**";
            user.IsActive  = !user.IsActive;
            //act
            var updatedUser = repository.AddUser(user);

            //assert
            Assert.IsTrue(updatedUser.FirstName == user.FirstName && updatedUser.LastName == user.LastName && updatedUser.Email == user.Email && updatedUser.IsActive == user.IsActive);
        }
 public RedirectResult AddUser(User user)
 {
     repositoty.AddUser(user);
     return(Redirect("/Home/ShowUsers"));
 }