public void GetProject_Test_ReturnSuccess()
        {
            project = new FakeDbSet <Project>();
            var testProject1 = new Project {
                Name = "Project1", CreatedOn = DateTime.Now, Detail = "This is project 1"
            };
            var testProject2 = new Project {
                Name = "Project2", CreatedOn = DateTime.Now, Detail = "This is project 2"
            };

            project.Add(testProject1);
            project.Add(testProject2);

            mockObject.Setup(m => m.Get()).Returns(project);
            ProjectController projectController = new ProjectController(mockObject.Object);
            var result = projectController.Get();

            Assert.NotNull(result);
        }
Пример #2
0
        public void GetTasks_Test_ReturnSuccess()
        {
            tasks = new FakeDbSet <Tasks>();
            var testTasks1 = new Tasks {
                ID = 1, AssignedToUserID = 1, ProjectID = 1, Detail = "Test Task 1", CreatedOn = DateTime.Now, Status = ProjectManagement.Entities.Enums.TaskStatus.New
            };
            var testTasks2 = new Tasks {
                ID = 2, AssignedToUserID = 1, ProjectID = 1, Detail = "Test Task 2", CreatedOn = DateTime.Now, Status = ProjectManagement.Entities.Enums.TaskStatus.New
            };

            tasks.Add(testTasks1);
            tasks.Add(testTasks2);

            mockObject.Setup(m => m.Get()).Returns(tasks);
            TasksController tasksController = new TasksController(mockObject.Object);
            var             result          = tasksController.Get();

            Assert.NotNull(result);
        }