コード例 #1
0
        public void TestInsertTasks_Success()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <ProjMgrDAC.User>();

            users.Add(new ProjMgrDAC.User()
            {
                Employee_ID = "654219",
                First_Name  = "Debdut",
                Last_Name   = "Ray",
                User_ID     = 457,
                Task_ID     = 457
            });
            context.Users = users;
            var task = new Models.Task()
            {
                TaskName  = "Colgate",
                ParentID  = 786987,
                ProjectID = 34856,
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now.AddDays(2),
                Priority  = 10,
                Status    = 0,
                User      = new User()
                {
                    FirstName  = "Debdut",
                    LastName   = "Ray",
                    EmployeeId = "654219",
                    UserId     = 1000
                }
            };

            var controller = new TaskController(new ProjMgrBC.TaskBc(context));
            var result     = controller.InsertTask(task) as JsonResponse;


            Assert.IsNotNull(result);

            Assert.IsNotNull((context.Users.Local[0]).Task_ID);
        }
コード例 #2
0
        public void TestDeleteUser_Success()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <ProjMgrDAC.User>();

            users.Add(new ProjMgrDAC.User()
            {
                Employee_ID = "415379",
                First_Name  = "Prasun",
                Last_Name   = "Sarkar",
                Project_ID  = 287,
                Task_ID     = 287,
                User_ID     = 401638
            });
            users.Add(new ProjMgrDAC.User()
            {
                Employee_ID = "416370",
                First_Name  = "Manas",
                Last_Name   = "Kundu",
                Project_ID  = 4579,
                Task_ID     = 4579,
                User_ID     = 445588
            });
            context.Users = users;

            var user = new Models.User();

            user.FirstName  = "Manas";
            user.LastName   = "Kundu";
            user.EmployeeId = "416370";
            user.UserId     = 445588;

            var controller = new UsersController(new ProjMgrBC.UserBc(context));
            var result     = controller.DeleteUser(user) as JsonResponse;

            Assert.IsNotNull(result);
            Assert.AreEqual(context.Users.Local.Count, 1);
        }
コード例 #3
0
        public void TestInsertProjects_Success()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <FSE_ProjMgr.ProjMgrDAC.User>();

            users.Add(new FSE_ProjMgr.ProjMgrDAC.User()
            {
                Employee_ID = "415379",
                First_Name  = "Prasun",
                Last_Name   = "Sarkar",
                User_ID     = 457,
                Task_ID     = 457
            });
            context.Users = users;
            var testProject = new FSE_ProjMgr.Models.Project()
            {
                ProjectId          = 77895,
                ProjectName        = "Book View Project",
                ProjectStartDate   = DateTime.Now,
                ProjectEndDate     = DateTime.Now.AddDays(5),
                Priority           = 3,
                NoOfCompletedTasks = 3,
                NoOfTasks          = 5,
                User = new User()
                {
                    FirstName  = "Prasun",
                    LastName   = "Sarkar",
                    EmployeeId = "778956",
                    UserId     = 457
                }
            };
            var controller = new ProjectController(new ProjMgrBC.ProjBc(context));
            var result     = controller.AddProject(testProject) as JsonResponse;

            Assert.IsNotNull(result);
            Assert.IsNotNull((context.Users.Local[0]).Project_ID);
        }
コード例 #4
0
        public void TestDeleteUser_InvalidProjectIdFormat()
        {
            var context = new MockProjectManagerEntities();
            var users   = new TestDbSet <ProjMgrDAC.User>();

            users.Add(new ProjMgrDAC.User()
            {
                Employee_ID = "415379",
                First_Name  = "Prasun",
                Last_Name   = "Sarkar",
                Project_ID  = 287,
                Task_ID     = 287,
                User_ID     = 401638
            });
            users.Add(new ProjMgrDAC.User()
            {
                Employee_ID = "416370",
                First_Name  = "Manas",
                Last_Name   = "Kundu",
                Project_ID  = 4579,
                Task_ID     = 4579,
                User_ID     = 445588
            });
            context.Users = users;

            var user = new Models.User();

            user.EmployeeId = "416370";
            user.FirstName  = "Manas";
            user.LastName   = "Kundu";
            user.ProjectId  = -1;
            user.UserId     = 415379;


            var controller = new UsersController(new ProjMgrBC.UserBc(context));
            var result     = controller.DeleteUser(user) as JsonResponse;
        }
コード例 #5
0
        public void TestRetrieveParentTasks_Success()
        {
            var context     = new MockProjectManagerEntities();
            var parentTasks = new TestDbSet <ProjMgrDAC.ParentTask>();

            parentTasks.Add(new ProjMgrDAC.ParentTask()
            {
                Parent_ID        = 77895,
                Parent_Task_Name = "Pepsodant"
            });
            parentTasks.Add(new ProjMgrDAC.ParentTask()
            {
                Parent_ID        = 778956,
                Parent_Task_Name = "GSI India"
            });
            context.ParentTasks = parentTasks;

            var controller = new TaskController(new ProjMgrBC.TaskBc(context));
            var result     = controller.GetParentTasks() as JsonResponse;

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