public void GetProjectTestBL()
        {
            Mock <ProjectManagerDBEntities> mockContext = MockProjectsSP();
            var taskManagerBL = new ProjectManagerBL(mockContext.Object);
            List <GetProjects_Result> projects = taskManagerBL.GetAllProjects();

            NUnit.Framework.Assert.IsNotNull(projects);
            foreach (var project in projects)
            {
                Assert.IsNotNull(project.Project_ID);
                Assert.IsNotNull(project.ProjectName);
                Assert.IsNotNull(project.Status);
                Assert.IsNotNull(project.Priority);
            }
        }
Exemplo n.º 2
0
        public void GetAllProjectTest()
        {
            ProjectManagerBL        tb     = new ProjectManagerBL(dbContext.Object);
            List <DetailedProjects> result = tb.GetAllProjects();

            Assert.AreEqual(result.Count, 3);
            Assert.AreEqual(result[0].ProjectId, 1);
            Assert.AreEqual(result[0].ProjectName, "QA & E");
            Assert.AreEqual(result[0].Priority, 3);
            Assert.AreEqual(result[0].StartDate, testDate);
            Assert.AreEqual(result[0].EndDate, testDate);
            Assert.AreEqual(result[0].ManagerId, 1);
            Assert.AreEqual(result[0].IsSuspended, false);
            Assert.AreEqual(result[0].TotalTasks, 3);
            Assert.AreEqual(result[0].CompletedTasks, 1);
            Assert.AreEqual(result[0].ManagerName, "John Smith");
        }
Exemplo n.º 3
0
        public void TestMethod2_GetAllProjects()
        {
            IEnumerable <Project> lstProjects = new List <Project>
            {
                new Project()
                {
                    Project_ID = 201, Project_Name = "GICR", Priority = 10, StartDate = DateTime.Now, EndDate = DateTime.Now,
                    Tasks      = new List <Task> {
                        new Task()
                        {
                            Task_ID = 100, Status = "Completed"
                        }, new Task()
                        {
                            Task_ID = 101, Status = "In Progress"
                        }
                    }
                    , Usrs = new List <Usr>()
                    {
                        new Usr()
                        {
                            Usr_ID = 100, FirstName = "Animesh", LastName = "Singh", Project_ID = 201, Task_ID = null, Employee_ID = 576113
                        },
                        new Usr()
                        {
                            Usr_ID = 101, FirstName = "Shreya", LastName = "Singh", Project_ID = 201, Task_ID = 100, Employee_ID = 458965
                        }
                    }
                },
                new Project()
                {
                    Project_ID = 202, Project_Name = "GIC", Priority = 15, StartDate = DateTime.Now, EndDate = DateTime.Now,
                    Tasks      = new List <Task> {
                        new Task()
                        {
                            Task_ID = 102, Status = "Completed"
                        }, new Task()
                        {
                            Task_ID = 103, Status = "In Progress"
                        }
                    }
                }
            };

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

            Mock <IProjectDbService> mock   = new Mock <IProjectDbService>();
            ProjectManagerBL         projBL = new ProjectManagerBL(mock.Object);

            mock.Setup(c => c.GetAllProjects()).Returns(lstProjects.AsQueryable());
            mock.Setup(c => c.GetAllUsers()).Returns(lstUsers.AsQueryable());

            int expectedcount = 2;
            var actual        = projBL.GetAllProjects();

            Assert.AreEqual(expectedcount, actual.Count());
        }
Exemplo n.º 4
0
        public IHttpActionResult GetAllProjects()
        {
            ProjectManagerBL obj = new ProjectManagerBL(_db);

            return(Ok(obj.GetAllProjects()));
        }
Exemplo n.º 5
0
 public IEnumerable <GetProjects_Result> GetProjects()
 {
     return(pbl.GetAllProjects());
 }