public void GetTaskTestBL()
        {
            Mock <ProjectManagerDBEntities> mockContext = MockTasksSP();
            var taskManagerBL            = new ProjectManagerBL(mockContext.Object);
            List <GetTasks_Result> tasks = taskManagerBL.GetAllTasks();

            NUnit.Framework.Assert.IsNotNull(tasks);
            foreach (var task in tasks)
            {
                Assert.IsNotNull(task.TaskName);
                Assert.IsNotNull(task.Task_ID);
                Assert.IsNotNull(task.Project_ID);
                Assert.IsNotNull(task.Parent_ID);
            }
        }
Ejemplo n.º 2
0
        public void GetAllTaskTest()
        {
            ProjectManagerBL     tb     = new ProjectManagerBL(dbContext.Object);
            List <DetailedTasks> result = tb.GetAllTasks(1);

            Assert.AreEqual(result.Count, 3);
            Assert.AreEqual(result[1].TaskId, 3);
            Assert.AreEqual(result[1].Task, "Task1");
            Assert.AreEqual(result[1].ProjectId, 1);
            Assert.AreEqual(result[1].ParentTaskId, 1);
            Assert.AreEqual(result[1].Priority, 9);
            Assert.AreEqual(result[1].StartDate, testDate);
            Assert.AreEqual(result[1].EndDate, testDate);
            Assert.AreEqual(result[1].UserId, 1);
            Assert.AreEqual(result[1].IsEnded, false);
            Assert.AreEqual(result[1].ParentTaskName, "ParentTask1");
            Assert.AreEqual(result[1].UserName, "John Smith");
            Assert.AreEqual(result[1].ProjectName, null);
        }
Ejemplo n.º 3
0
        public void TestMethod1_GetAllTasks()
        {
            IEnumerable <DAL.Task> lstTask = new List <DAL.Task>()
            {
                new DAL.Task()
                {
                    Task_ID = 100, Task_Name = "Task1", Project_ID = 201, StartDate = DateTime.Now, EndDate = DateTime.Now, ParentTask = new DAL.ParentTask()
                    {
                        Parent_ID = 100, Parent_Task = "Parent1"
                    }, Parent_ID = 100, Priority = 10, Usrs =
                        new List <Usr> {
                        new Usr()
                        {
                            Usr_ID = 100, FirstName = "Animesh", LastName = "Singh", Project_ID = 201, Task_ID = 100, Employee_ID = 576113
                        }
                    }
                    , Project = new Project()
                    {
                        Project_ID = 201, Project_Name = "GICR", Priority = 10
                    }
                },
                new DAL.Task()
                {
                    Task_ID = 101, Task_Name = "Task2", Project_ID = 202, StartDate = DateTime.Now, EndDate = DateTime.Now, ParentTask = new DAL.ParentTask()
                    {
                        Parent_ID = 100, Parent_Task = "Parent1"
                    }, Parent_ID = 100, Priority = 10, Usrs =
                        new List <Usr> {
                        new Usr()
                        {
                            Usr_ID = 101, FirstName = "Shreya", LastName = "Singh", Project_ID = 202, Task_ID = 101, Employee_ID = 458965
                        }
                    }
                    , Project = new Project()
                    {
                        Project_ID = 202, Project_Name = "GICB", Priority = 10
                    }
                },
                new DAL.Task()
                {
                    Task_ID = 102, Task_Name = "Task3", Project_ID = 203, StartDate = DateTime.Now, EndDate = DateTime.Now, ParentTask = new DAL.ParentTask()
                    {
                        Parent_ID = 100, Parent_Task = "Parent1"
                    }, Parent_ID = 100, Priority = 10, Usrs = null
                    , Project    = new Project()
                    {
                        Project_ID = 202, Project_Name = "EDGE", Priority = 10
                    }
                },
                new DAL.Task()
                {
                    Task_ID = 103, Task_Name = "Task4", Project_ID = 204, StartDate = DateTime.Now, EndDate = DateTime.Now, ParentTask = new DAL.ParentTask()
                    {
                        Parent_ID = 100, Parent_Task = "Parent1"
                    }, Parent_ID = 100, Priority = 10, Usrs = null
                    , Project    = new Project()
                    {
                        Project_ID = 202, Project_Name = "REMITONE", Priority = 10
                    }
                },
                new DAL.Task()
                {
                    Task_ID = 104, Task_Name = "Task5", Project_ID = 205, StartDate = DateTime.Now, EndDate = DateTime.Now, ParentTask = new DAL.ParentTask()
                    {
                        Parent_ID = 100, Parent_Task = "Parent1"
                    }, Parent_ID = 100, Priority = 10, Usrs = null
                    , Project    = new Project()
                    {
                        Project_ID = 202, Project_Name = "MBT", Priority = 10
                    }
                }
            };

            IEnumerable <Usr> lstUsers = new List <Usr>()
            {
                new Usr()
                {
                    Usr_ID = 100, FirstName = "Animesh", LastName = "Singh", Project_ID = 201, Task_ID = 100, Employee_ID = 576113
                },
                new Usr()
                {
                    Usr_ID = 101, FirstName = "Shreya", LastName = "Singh", Project_ID = 202, Task_ID = 101, Employee_ID = 458965
                }
            };

            IEnumerable <ParentTask> lstParent = new List <ParentTask>()
            {
                new ParentTask()
                {
                    Parent_ID = 100, Parent_Task = "Parent1"
                },
                new ParentTask()
                {
                    Parent_ID = 101, Parent_Task = "Parent2"
                }
            };
            Mock <IProjectDbService> mock   = new Mock <IProjectDbService>();
            ProjectManagerBL         projBL = new ProjectManagerBL(mock.Object);

            mock.Setup(c => c.GetAllTasks()).Returns(lstTask.AsQueryable());
            mock.Setup(c => c.GetAllUsers()).Returns(lstUsers.AsQueryable());
            mock.Setup(c => c.GetAllParentTasks()).Returns(lstParent.AsQueryable());

            int expectedcount = 7;
            var actual        = projBL.GetAllTasks();

            Assert.AreEqual(expectedcount, actual.Count());
        }
Ejemplo n.º 4
0
        public IHttpActionResult GetAllTasks(int id)
        {
            ProjectManagerBL obj = new ProjectManagerBL(_db);

            return(Ok(obj.GetAllTasks(id)));
        }
Ejemplo n.º 5
0
 public IEnumerable <GetTasks_Result> GetTasks()
 {
     return(pbl.GetAllTasks());
 }