Esempio n. 1
0
        public void TestRetrieveTasks_Success()
        {
            var context     = new MockProjectManagerEntities();
            var tasks       = new TestDbSet <ProjMgrDAC.Task>();
            var users       = new TestDbSet <ProjMgrDAC.User>();
            var parentTasks = new TestDbSet <ProjMgrDAC.ParentTask>();

            parentTasks.Add(new ProjMgrDAC.ParentTask()
            {
                Parent_ID        = 778956,
                Parent_Task_Name = "GSI India"
            });
            context.ParentTasks = parentTasks;
            users.Add(new ProjMgrDAC.User()
            {
                Employee_ID = "415379",
                First_Name  = "Prasun",
                Last_Name   = "Sarkar",
                User_ID     = 457,
                Task_ID     = 1
            });
            context.Users = users;
            int projectid = 7789;

            tasks.Add(new ProjMgrDAC.Task()
            {
                Task_ID    = 1,
                Task_Name  = "Colgate",
                Parent_ID  = 457986,
                Project_ID = 1874,
                Start_Date = DateTime.Now,
                End_Date   = DateTime.Now.AddDays(2),
                Priority   = 10,
                Status     = 0
            });
            context.Tasks = tasks;
            var controller = new TaskController(new ProjMgrBC.TaskBc(context));
            var result     = controller.GetTaskByProjId(projectid) as JsonResponse;

            //Assert.IsNotNull(result);
            //Assert.IsInstanceOfType(result.Data, typeof(List<Models.Task>));
        }
Esempio n. 2
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);
        }
Esempio n. 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);
        }