Ejemplo n.º 1
0
        public void TestUpdateProject_NoProjectAsParameter()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "469176",
                First_Name  = "Devanjan",
                Last_Name   = "Bhattacharya",
                User_ID     = 123,
                Task_ID     = 123
            });
            context.Users = users;
            Models.Project testProject = null;
            var            controller  = new ProjectController(new BC.ProjectBC(context));
            var            result      = controller.UpdateProjectDetails(testProject) as JSendResponse;
        }
Ejemplo n.º 2
0
        public void TestDeleteProject_NoProjectAsParameter()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "401628",
                First_Name  = "Switz",
                Last_Name   = "Jeoff",
                User_ID     = 123,
                Task_ID     = 123
            });
            context.Users = users;
            Models.Project testProject = null;
            var            controller  = new ProjectController(new BC.ProjectBC(context));
            var            result      = controller.DeleteProjectDetails(testProject) as JSendResponse;
        }
Ejemplo n.º 3
0
        public void TestUpdateProject_NoProjectAsParameter()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "730496",
                First_Name  = "Subhasis",
                Last_Name   = "Sarkar",
                User_ID     = 123,
                Task_ID     = 123
            });
            context.Users = users;
            Models.Project testProject = null;
            var            controller  = new ProjectController(new BC.ProjectBC(context));
            var            result      = controller.UpdateProjectDetails(testProject) as JSONResponseModel;
        }
Ejemplo n.º 4
0
        public void TestRetrieveTasks_Success()
        {
            var context     = new MockProjectManagerEntities();
            var tasks       = new TestDbSet <DAC.Task>();
            var users       = new TestDbSet <DAC.User>();
            var parentTasks = new TestDbSet <DAC.ParentTask>();

            parentTasks.Add(new DAC.ParentTask()
            {
                Parent_ID        = 123456,
                Parent_Task_Name = "PNB"
            });
            context.ParentTasks = parentTasks;
            users.Add(new DAC.User()
            {
                Employee_ID = "453388",
                First_Name  = "Shilpa",
                Last_Name   = "Agarwalla",
                User_ID     = 123,
                Task_ID     = 1
            });
            context.Users = users;
            int projectid = 1234;

            tasks.Add(new DAC.Task()
            {
                Task_ID    = 1,
                Task_Name  = "ASDQW",
                Parent_ID  = 123456,
                Project_ID = 1234,
                Start_Date = DateTime.Now,
                End_Date   = DateTime.Now.AddDays(2),
                Priority   = 10,
                Status     = 0
            });
            context.Tasks = tasks;
            var controller = new TaskController(new BC.TaskBC(context));
            var result     = controller.RetrieveTaskByProjectId(projectid) as JSendResponse;

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result.Data, typeof(List <ProjectManager.Models.Task>));
        }
Ejemplo n.º 5
0
        public void TestDeleteProject_NoProjectAsParameter()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                First_Name  = "User4FName",
                Last_Name   = "User4LName",
                Employee_ID = "100001",
                User_ID     = 123,
                Task_ID     = 123
            });
            context.Users = users;
            Models.Project testProject = null;
            var            controller  = new ProjectController(new BC.ProjectBC(context));

            Assert.That(() => controller.DeleteProjectDetails(testProject),
                        Throws.TypeOf <ArgumentNullException>());
        }
        public void TestDeleteProject_NoProjectAsParameter()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "414942",
                First_Name  = "Raj",
                Last_Name   = "Aryan",
                User_ID     = 123,
                Task_ID     = 123
            });
            context.Users = users;
            Models.Project testProject = null;
            var            controller  = new ProjectController(new BC.ProjectBC(context));
            var            ex          = Assert.Throws <ArgumentNullException>(() => controller.DeleteProjectDetails(testProject));

            Assert.That(ex.Message, Is.Not.Null);
        }
Ejemplo n.º 7
0
        public void TestInsertTasks_Success()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "654219",
                First_Name  = "Rajesh",
                Last_Name   = "Ray",
                User_ID     = 123,
                Task_ID     = 123
            });
            context.Users = users;
            var task = new ProjectManager.Models.Task()
            {
                Task_Name  = "ASDQW",
                Parent_ID  = 123674,
                Project_ID = 34856,
                Start_Date = DateTime.Now,
                End_Date   = DateTime.Now.AddDays(2),
                Priority   = 10,
                Status     = 0,
                User       = new User()
                {
                    FirstName  = "Rajesh",
                    LastName   = "Ray",
                    EmployeeId = "654219",
                    UserId     = 1000
                }
            };

            var controller = new TaskController(new BC.TaskBC(context));
            var result     = controller.InsertTaskDetails(task) as JSendResponse;


            Assert.IsNotNull(result);

            Assert.IsNotNull((context.Users.Local[0]).Task_ID);
        }
        public void TestDeleteUser_Success()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "418220",
                First_Name  = "Sweta",
                Last_Name   = "Misra",
                Project_ID  = 123,
                Task_ID     = 123,
                User_ID     = 418220
            });
            users.Add(new DAC.User()
            {
                Employee_ID = "503322",
                First_Name  = "ABC",
                Last_Name   = "XYZ",
                Project_ID  = 1234,
                Task_ID     = 1234,
                User_ID     = 503322
            });
            context.Users = users;

            var user = new Models.User();

            user.FirstName  = "ABC";
            user.LastName   = "XYZ";
            user.EmployeeId = "503322";
            user.UserId     = 503322;

            var controller = new UserController(new BC.UserBC(context));
            var result     = controller.DeleteUserDetails(user) as JSendResponse;

            Assert.IsNotNull(result);
            Assert.AreEqual(context.Users.Local.Count, 1);
        }
        public void TestDeleteUser_Success()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "401638",
                First_Name  = "Subhasis",
                Last_Name   = "Sarkar",
                Project_ID  = 123,
                Task_ID     = 123,
                User_ID     = 401638
            });
            users.Add(new DAC.User()
            {
                Employee_ID = "900001",
                First_Name  = "Virat",
                Last_Name   = "Kohli",
                Project_ID  = 1234,
                Task_ID     = 1234,
                User_ID     = 900001
            });
            context.Users = users;

            var user = new Models.User();

            user.FirstName  = "Virat";
            user.LastName   = "Kohli";
            user.EmployeeId = "900001";
            user.UserId     = 900001;

            var controller = new UserController(new BC.UserBC(context));
            var result     = controller.DeleteUserDetails(user) as JSONResponseModel;

            Assert.IsNotNull(result);
            Assert.AreEqual(context.Users.Local.Count, 1);
        }
Ejemplo n.º 10
0
        public void TestDeleteUser_Success()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "401638",
                First_Name  = "Amantrita",
                Last_Name   = "Ghosh",
                Project_ID  = 123,
                Task_ID     = 123,
                User_ID     = 401638
            });
            users.Add(new DAC.User()
            {
                Employee_ID = "401630",
                First_Name  = "Arnabi",
                Last_Name   = "Mandal",
                Project_ID  = 1234,
                Task_ID     = 1234,
                User_ID     = 401630
            });
            context.Users = users;

            var user = new Models.User();

            user.FirstName  = "Arnabi";
            user.LastName   = "Mandal";
            user.EmployeeId = "401630";
            user.UserId     = 401630;

            var controller = new UserController(new BC.UserBC(context));
            var result     = controller.DeleteUserDetails(user) as JSendResponse;

            Assert.IsNotNull(result);
            Assert.AreEqual(context.Users.Local.Count, 1);
        }
        public void TestUpdateProject_CompletedTasksGreater()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "414942",
                First_Name  = "Sweta",
                Last_Name   = "Misra",
                User_ID     = 123,
                Task_ID     = 123
            });
            context.Users = users;
            Models.Project testProject = new Models.Project()
            {
                ProjectId          = 234,
                NoOfCompletedTasks = 10,
                NoOfTasks          = 5,
                Priority           = 1,
                ProjectEndDate     = DateTime.Now.AddDays(10),
                ProjectStartDate   = DateTime.Now,
                ProjectName        = "TEST",
                User = new User()
                {
                    EmployeeId = 123.ToString(),
                    FirstName  = "SWETA",
                    LastName   = "MISRA",
                    ProjectId  = 234,
                    UserId     = 123
                }
            };
            var controller = new ProjectController(new BC.ProjectBC(context));

            var ex = Assert.Throws <ArgumentException>(() => controller.UpdateProjectDetails(testProject));

            Assert.That(ex.Message, Is.Not.Null);
        }
Ejemplo n.º 12
0
        public void TestDeleteUser_Success()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "419773",
                First_Name  = "Amartya",
                Last_Name   = "Pal",
                Project_ID  = 1001,
                Task_ID     = 1001,
                User_ID     = 419773
            });
            users.Add(new DAC.User()
            {
                Employee_ID = "419771",
                First_Name  = "Naveen",
                Last_Name   = "Sivaraju",
                Project_ID  = 1002,
                Task_ID     = 1002,
                User_ID     = 419771
            });
            context.Users = users;

            var user = new Models.User();

            user.FirstName  = "Naveen";
            user.LastName   = "Sivaraju";
            user.EmployeeId = "419771";
            user.UserId     = 419771;

            var controller = new UserController(new BC.UserBC(context));
            var result     = controller.DeleteUserDetails(user) as JSendResponse;

            Assert.IsNotNull(result);
            Assert.AreEqual(context.Users.Local.Count, 1);
        }
Ejemplo n.º 13
0
        public void TestDeleteUser_Success()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "606187",
                First_Name  = "Indranil",
                Last_Name   = "Mukherjee",
                Project_ID  = 123,
                Task_ID     = 123,
                User_ID     = 606187
            });
            users.Add(new DAC.User()
            {
                Employee_ID = "808187",
                First_Name  = "Ankita",
                Last_Name   = "Banerjee",
                Project_ID  = 1234,
                Task_ID     = 1234,
                User_ID     = 808187
            });
            context.Users = users;

            var user = new Models.User();

            user.FirstName  = "Ankita";
            user.LastName   = "Banerjee";
            user.EmployeeId = "808187";
            user.UserId     = 808187;

            var controller = new UserController(new BC.UserBC(context));
            var result     = controller.DeleteUserDetails(user) as JSendResponse;

            Assert.IsNotNull(result);
            Assert.AreEqual(context.Users.Local.Count, 1);
        }
Ejemplo n.º 14
0
        public void TestInsertProjects_Success()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                Employee_ID = "414942",
                First_Name  = "Rishaan",
                Last_Name   = "Basu",
                User_ID     = 123,
                Task_ID     = 123
            });
            context.Users = users;
            var testProject = new Models.Project()
            {
                ProjectId          = 12345,
                ProjectName        = "MyProject",
                ProjectStartDate   = DateTime.Now,
                ProjectEndDate     = DateTime.Now.AddDays(5),
                Priority           = 3,
                NoOfCompletedTasks = 3,
                NoOfTasks          = 5,
                User = new User()
                {
                    FirstName  = "Rishaan",
                    LastName   = "Basu",
                    EmployeeId = "123456",
                    UserId     = 123
                }
            };
            var controller = new ProjectController(new BC.ProjectBC(context));
            var result     = controller.InsertProjectDetails(testProject) as JSendResponse;

            Assert.IsNotNull(result);
            Assert.IsNotNull((context.Users.Local[0]).Project_ID);
        }
Ejemplo n.º 15
0
        public void TestDeleteProject_CompletedTasksGreater()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <DAC.User>();

            users.Add(new DAC.User()
            {
                First_Name  = "User4FName",
                Last_Name   = "User4LName",
                Employee_ID = "100001",
                User_ID     = 123,
                Task_ID     = 123
            });
            context.Users = users;
            Models.Project testProject = new Models.Project()
            {
                ProjectId          = 234,
                NoOfCompletedTasks = 10,
                NoOfTasks          = 5,
                Priority           = 1,
                ProjectEndDate     = DateTime.Now.AddDays(10),
                ProjectStartDate   = DateTime.Now,
                ProjectName        = "TEST",
                User = new User()
                {
                    EmployeeId = "100001",
                    FirstName  = "User2FName",
                    LastName   = "User2LName",
                    ProjectId  = 234,
                    UserId     = 123
                }
            };
            var controller = new ProjectController(new BC.ProjectBC(context));

            Assert.That(() => controller.DeleteProjectDetails(testProject),
                        Throws.TypeOf <ArgumentException>());
        }
Ejemplo n.º 16
0
        public void TestRetrieveParentTasks_Success()
        {
            var context     = new MockProjectManagerEntities();
            var parentTasks = new TestDbSet <DAC.ParentTask>();

            parentTasks.Add(new DAC.ParentTask()
            {
                Parent_ID        = 12345,
                Parent_Task_Name = "ANB"
            });
            parentTasks.Add(new DAC.ParentTask()
            {
                Parent_ID        = 123456,
                Parent_Task_Name = "PNB"
            });
            context.ParentTasks = parentTasks;

            var controller = new TaskController(new BC.TaskBC(context));
            var result     = controller.RetrieveParentTasks() as JSendResponse;

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result.Data, typeof(List <ProjectManager.Models.ParentTask>));
            Assert.AreEqual((result.Data as List <ParentTask>).Count, 2);
        }