Пример #1
0
        public void GetSpecificTask()
        {
            var mockObj       = new Mock <IRepository>();
            var businessLayer = new BusinessLayer.ProjectManagerCore(mockObj.Object);
            var tasks         = new DataLayer.Task()
            {
                Task1 = "TestTest", Start_Date = DateTime.Now, End_Date = DateTime.Now.AddDays(7), Parent_ID = 5
            };

            mockObj.Setup(x => x.GetSpecificTask(It.IsAny <int>())).Returns(tasks);
            //Assert
            var actualTasks = businessLayer.GetSpecificTask(It.IsAny <int>());

            Assert.AreEqual(tasks.Task1, actualTasks.Task);
        }
Пример #2
0
        public void AddTask(Models.TaskModel taskModel)
        {
            var task = new DataLayer.Task();

            task.Task1    = taskModel.Task;
            task.Priority = taskModel.Priority;
            if (taskModel.StartDate != null)
            {
                task.Start_Date = Convert.ToDateTime(taskModel.StartDate);
            }
            if (taskModel.EndDate != null)
            {
                task.End_Date = Convert.ToDateTime(taskModel.EndDate);
            }
            _repository.AddTask(task, taskModel.Parent_ID, taskModel.User_ID, taskModel.Project_ID);
        }