Exemplo n.º 1
0
        public void TestGetAllUsers()
        {
            ProjectManagerController taskManagerController = new ProjectManagerController();
            IEnumerable <User>       users = taskManagerController.GetAllUsers();

            Assert.IsNotNull(users);
        }
        public void When_GetAllUsers_Then_VerifyResults()
        {
            var result = controller.GetAllUsers() as OkNegotiatedContentResult <List <UserEntity> >;

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Content.Count, 1);
        }
Exemplo n.º 3
0
        public void GetAllUserTest()
        {
            ProjectManagerController tb = new ProjectManagerController(dbContext.Object);
            var result = tb.GetAllUsers() as OkNegotiatedContentResult <List <Users> >;

            Assert.AreEqual(result.Content.Count, 3);
            Assert.AreEqual(result.Content[0].EmployeeId, "IT001");
        }
Exemplo n.º 4
0
        public void TestAddUser()
        {
            ProjectManagerController taskManagerController = new ProjectManagerController();

            taskManagerController.AddUser(new Models.User()
            {
                FirstName = "Raja", LastName = "S", EmployeeId = "426936"
            });
            IEnumerable <User> users = taskManagerController.GetAllUsers();

            Assert.IsNotNull(users);
            Assert.IsNotNull(users.Where(t => t.EmployeeId == "426936").First());
        }
Exemplo n.º 5
0
        public void TestGetUser()
        {
            ProjectManagerController taskManagerController = new ProjectManagerController();

            taskManagerController.AddUser(new Models.User()
            {
                FirstName = "newUser", LastName = "test", EmployeeId = "empId"
            });
            IEnumerable <User> users = taskManagerController.GetAllUsers();

            Assert.IsNotNull(users);
            int  userId = users.FirstOrDefault().UserId;
            User user   = taskManagerController.GetUser(userId);

            Assert.IsNotNull(user);
        }
Exemplo n.º 6
0
        public void TestDeleteUser()
        {
            ProjectManagerController taskManagerController = new ProjectManagerController();

            taskManagerController.AddUser(new Models.User()
            {
                FirstName = "TestDelete1", LastName = "Test", EmployeeId = "test"
            });
            IEnumerable <User> users = taskManagerController.GetAllUsers();

            Assert.IsNotNull(users);
            int  userId = users.Where(t => t.FirstName == "TestDelete1").FirstOrDefault().UserId;
            User user   = taskManagerController.GetUser(userId);

            taskManagerController.DeleteUser(userId);
            user = taskManagerController.GetUser(userId);
            Assert.IsNull(user);
        }
Exemplo n.º 7
0
        public void TestUpdateUser()
        {
            ProjectManagerController taskManagerController = new ProjectManagerController();

            taskManagerController.AddUser(new Models.User()
            {
                FirstName = "editUser", LastName = "test", EmployeeId = "empId"
            });
            IEnumerable <User> users = taskManagerController.GetAllUsers();

            Assert.IsNotNull(users);
            User   user    = users.Where(t => t.FirstName == "editUser").FirstOrDefault();
            string newName = user.FirstName + "Renamed";

            user.FirstName = newName;
            taskManagerController.UpdateUser(user);
            user = taskManagerController.GetUser(user.UserId);
            Assert.IsTrue(user.FirstName == newName);
        }
Exemplo n.º 8
0
 public void GetAllUser_IterationsMode()
 {
     var result = tb.GetAllUsers() as OkNegotiatedContentResult <List <Users> >;
 }