public void TestEndTask()
        {
            bool actualResult   = false;
            bool expectedResult = true;

            Entities.Task itemToEnd = new Entities.Task();

            TaskLogic            businessObject = new TaskLogic();
            List <Entities.Task> taskList       = new List <Entities.Task>();

            taskList = businessObject.GetAll();

            itemToEnd = taskList.Where(item => item.Is_End_Task.Equals(false)).FirstOrDefault();
            if (itemToEnd != null)
            {
                businessObject.EndTask(itemToEnd.Task_Id);
                taskList  = businessObject.GetAll();
                itemToEnd = taskList.Where(item => item.Task_Id.Equals(itemToEnd.Task_Id)).FirstOrDefault();
                if (itemToEnd.Is_End_Task ?? true)
                {
                    actualResult = true;
                }
            }
            Assert.AreEqual(actualResult, expectedResult);
        }
Exemplo n.º 2
0
        //
        // GET: /Account/Register

        public List <SelectListItem> GetUserTypesList()
        {
            TaskLogic logic = new TaskLogic();

            //List<SelectListItem> list = logic.GetUserTypes().Select(x =>
            //    new SelectListItem()
            //    {
            //        Text = x.Name,
            //        Value = x.UserTypeId.ToString()
            //    }
            //    ).ToList();

            List <SelectListItem> list2 = new List <SelectListItem>();

            list2.Add(new SelectListItem()
            {
                Text  = "Исполнитель",
                Value = "Исполнитель"
            });

            list2.Add(new SelectListItem()
            {
                Text  = "Заказчик",
                Value = "Заказчик"
            });
            return(list2);
        }
Exemplo n.º 3
0
        public TaskBasicsTests()
        {
            var mockMapper = new MapperConfiguration(cfg => cfg.AddProfile(new MappingProfile()));

            _mapper   = mockMapper.CreateMapper();
            taskLogic = new TaskLogic(new TaskContextMock(), _mapper);
        }
        public void TestUpdate()
        {
            bool actualResult   = true;
            bool expectedResult = true;

            Entities.Task itemToUpdate = new Entities.Task();

            TaskLogic            businessObject = new TaskLogic();
            List <Entities.Task> taskList       = new List <Entities.Task>();

            taskList = businessObject.GetAll();

            itemToUpdate = taskList.FirstOrDefault();

            itemToUpdate.Task_Name = "UpdatedTaskName_Nunit";
            businessObject.Update(itemToUpdate);

            itemToUpdate = businessObject.GetTaskById(itemToUpdate.Task_Id);

            if (!itemToUpdate.Task_Name.Equals("UpdatedTaskName_Nunit"))
            {
                actualResult = false;
            }

            itemToUpdate.Parent_Task = "UpdatedParentTask_Nunit";
            businessObject.Update(itemToUpdate);
            itemToUpdate = businessObject.GetTaskById(itemToUpdate.Task_Id);
            if (!itemToUpdate.Parent_Task.Equals("UpdatedParentTask_Nunit"))
            {
                actualResult = false;
            }

            Assert.AreEqual(actualResult, expectedResult);
        }
        private async void SaveTaskBtn_Clicked(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(taskName.Text))
            {
                await DisplayAlert("Greška!", "Naziv zadatka je obavezan", "OK");

                return;
            }

            taskActivityIndicator.IsVisible = true;
            saveTaskBtn.IsEnabled           = false;

            DateTime date = taskDueDate.Date;

            date.Add(taskDueTime.Time);

            string taskPriorityStr;

            if (taskPriority.SelectedIndex == -1)
            {
                taskPriority.SelectedIndex = 0;
                taskPriorityStr            = "Niski";
            }
            else
            {
                taskPriorityStr = taskPriority.SelectedItem.ToString();
            }

            TaskItem taskItem = new TaskItem()
            {
                Name         = taskName.Text,
                Priority     = taskPriority.SelectedIndex,
                PriorityText = taskPriorityStr,
                DueDate      = date,
                RemindMe     = taskReminder.IsToggled
            };

            bool success = false;

            if (_taskItem != null)
            {
                success = await TaskLogic.EditTask(taskItem, _taskItem);
            }
            else
            {
                success = await TaskLogic.AddTask(taskItem);
            }

            if (success)
            {
                await Navigation.PopAsync(false);
            }
            else
            {
                await DisplayAlert("Greška!", "Zadatak nije spremljen", "OK");
            }

            taskActivityIndicator.IsVisible = false;
            saveTaskBtn.IsEnabled           = true;
        }
Exemplo n.º 6
0
        public TaskIntegrationTests()
        {
            var mockMapper = new MapperConfiguration(cfg => cfg.AddProfile(new MappingProfile()));

            _mapper   = mockMapper.CreateMapper();
            taskLogic = new TaskLogic(new TaskRepository(new DatabaseTask(new DatabaseConnection("Server = mssql.fhict.local; Database = dbi409997; User Id = dbi409997; Password = Ikbencool20042000!;"))), _mapper);
        }
Exemplo n.º 7
0
        private async void TasksListRefreshing(object sender, EventArgs e)
        {
            Constants.TasksList = await TaskLogic.GetTasks();

            tasksListView.IsRefreshing = false;
            SetItemsSource();
        }
Exemplo n.º 8
0
        private async void RefreshTasks_Clicked(object sender, EventArgs e)
        {
            tasksListView.IsRefreshing = true;
            Constants.TasksList        = await TaskLogic.GetTasks();

            SetItemsSource();
            tasksListView.IsRefreshing = false;
        }
Exemplo n.º 9
0
    void Start()
    {
        _functionCaller = new FunctionCaller(); //[TO DO]: Avoid "new" (D in SOLID)
        _taskLogic      = new TaskLogic();      //[TO DO]: Avoid "new" (D in SOLID)
        _taskLogic.LoadNumbers();

        StartCoroutine(_functionCaller.CallFunctionAfterDelay(0.5f, GenerateTask)); //give time to read file
    }
        public void returnTaskId_CanReturnTaskID_ReturnNotNull()
        {
            var taskLogic = new TaskLogic();

            taskIDTest = taskLogic.returnTaskId();

            Assert.IsNotNull(taskIDTest);
        }
Exemplo n.º 11
0
        /*without above HTTP get wilkl get error → No webpage was found for the web address: https://localhost:5001/api/Employee/getcurrentuser*/
        public string  GetCurrentUser()
        {
            string    currentUser;
            TaskLogic t = new TaskLogic(_context);

            currentUser = t.GetEmployee().UserId;
            return(currentUser);
        }
Exemplo n.º 12
0
        public async void OnDelete(object sender, EventArgs e)
        {
            MenuItem menuItem = ((MenuItem)sender);
            TaskItem taskItem = (TaskItem)menuItem.CommandParameter;
            await TaskLogic.DeleteTask(taskItem);

            SetItemsSource();
        }
Exemplo n.º 13
0
        public async Task Test_Get_User_Tasks_No_Tasks_Integration()
        {
            var taskLogic = new TaskLogic(_taskRepo, _fieldRepository, _answerRepo, _userRepo, _studyRepo, _taskDelegationRepository, _phaseRepository);

            // Act
            var userTasks = await taskLogic.GetUserTasks(study1.Id, 9); // Not a user with any tasks

            // Assert
            Assert.Equal(0, userTasks.Count());
        }
        public IHttpActionResult GetTaskByID(int taskId)
        {
            TaskLogic blTask = new TaskLogic();
            var       task   = blTask.GetTaskById(taskId);

            if (task != null)
            {
                return(Ok(task));
            }
            return(NotFound());
        }
Exemplo n.º 15
0
        public async Task Test_Get_User_Tasks_Success_Integration()
        {
            var taskLogic = new TaskLogic(_taskRepo, _fieldRepository, _answerRepo, _userRepo, _studyRepo, _taskDelegationRepository, _phaseRepository);

            // Act
            var userTasks = await taskLogic.GetUserTasks(study1.Id, 16);

            // Assert
            Assert.Equal(1, userTasks.Count()); // There's two tasks, but only one for this user
            Assert.Equal(11, userTasks.First().Id);
        }
Exemplo n.º 16
0
        public async Task Test_Submit_Task_Success_Integration()
        {
            var taskLogic = new TaskLogic(_taskRepo, _fieldRepository, _answerRepo, _userRepo, _studyRepo, _taskDelegationRepository, _phaseRepository);

            // Act
            var submitted = await taskLogic.SubmitTask(task1);

            // Assert
            Assert.True(submitted);
            Assert.True(task1.IsSubmitted);
        }
Exemplo n.º 17
0
        public void A_removeTask()
        {
            var  taskLogic = new TaskLogic();
            Task task      = new Task();

            task.TaskID      = 1;
            task.ProjectCode = "AAA111";

            var result = taskLogic.removeTask(task);

            Assert.IsTrue(result);
        }
Exemplo n.º 18
0
 public bool UpdateStatusTask(Task obj)
 {
     TaskLogic tskSrv = new TaskLogic();
     Task tsk = tskSrv.UpdateTask(obj);
     if (tsk.Dirty) {
         //Non è stato modificato
         // Loggare errore
         return false;
     } else {
         //E' stato modificato
         return true;
     }
 }
Exemplo n.º 19
0
        public void Test_Get_User_Tasks_No_Tasks()
        {
            // Arrange
            _mockStudyRepo.Setup(r => r.ReadAsync(study1.Id)).ReturnsAsync(study1);

            var taskLogic = new TaskLogic(_mockTaskRepo.Object, _mockFieldRepo.Object, _mockAnswerRepo.Object, _mockUserRepo.Object, _mockStudyRepo.Object, _mockTaskDelegationRepo.Object, _mockPhaseRepo.Object);

            // Act
            var userTasks = taskLogic.GetUserTasks(study1.Id, 9).Result; // Not a user with any tasks

            // Assert
            Assert.Equal(0, userTasks.Count());
        }
Exemplo n.º 20
0
        public void Test_Submit_Task_Failure()
        {
            // Arrange
            var taskLogic = new TaskLogic(_mockTaskRepo.Object, _mockFieldRepo.Object, _mockAnswerRepo.Object, _mockUserRepo.Object, _mockStudyRepo.Object, _mockTaskDelegationRepo.Object, _mockPhaseRepo.Object);

            // Act
            var submitted_null       = taskLogic.SubmitTask(null).Result;                // Null
            var submitted_empty_task = taskLogic.SubmitTask(new ReviewTaskDTO()).Result; // Empty task

            // Assert
            Assert.False(submitted_null);
            Assert.False(submitted_empty_task); // TODO We would expect it to return false, but the program crashes
        }
        public IHttpActionResult EndTask(int taskId)
        {
            TaskLogic blTask = new TaskLogic();

            try
            {
                blTask.EndTask(taskId);
            }
            catch (Exception ex)
            {
                return(Ok(ex.Message));
            }
            return(Ok(blTask.GetAll()));
        }
        public IHttpActionResult UpdateTask(Task item)
        {
            TaskLogic blTask = new TaskLogic();

            try
            {
                blTask.Update(item);
            }
            catch (Exception ex)
            {
                return(Ok(ex.Message));
            }
            return(Ok());
        }
Exemplo n.º 23
0
        public void Test_Get_User_Tasks_Success()
        {
            // Arrange
            _mockStudyRepo.Setup(r => r.ReadAsync(study1.Id)).ReturnsAsync(study1);

            var taskLogic = new TaskLogic(_mockTaskRepo.Object, _mockFieldRepo.Object, _mockAnswerRepo.Object, _mockUserRepo.Object, _mockStudyRepo.Object, _mockTaskDelegationRepo.Object, _mockPhaseRepo.Object);

            // Act
            var userTasks = taskLogic.GetUserTasks(study1.Id, 16).Result;

            // Assert
            Assert.Equal(1, userTasks.Count()); // There's two tasks, but only one for this user
            Assert.Equal(11, userTasks.First().Id);
        }
Exemplo n.º 24
0
        public async Task Test_Submit_Task_Failure_Integration()
        {
            // Arrange
            var taskLogic = new TaskLogic(_taskRepo, _fieldRepository, _answerRepo, _userRepo, _studyRepo, _taskDelegationRepository, _phaseRepository);

            // Act
            var submitted_null = await taskLogic.SubmitTask(null);                      // Null

            var submitted_empty_task = await taskLogic.SubmitTask(new ReviewTaskDTO()); // Empty task

            // Assert
            Assert.False(submitted_null);
            Assert.False(submitted_empty_task); // TODO We would expect it to return false, but the program crashes
        }
        public void TestGetAll()
        {
            bool actualResult   = false;
            bool expectedResult = true;

            TaskLogic            businessObject = new TaskLogic();
            List <Entities.Task> taskList       = new List <Entities.Task>();

            taskList = businessObject.GetAll();
            if (taskList.Count > 0)
            {
                actualResult = true;
            }
            Assert.AreEqual(actualResult, expectedResult);
        }
        public void returnAllTasksForProject_CanGetAllTasksForProject()
        {
            DBBroker broker    = new DBBroker();
            var      taskLogic = new TaskLogic();
            Project  project   = new Project()
            {
                ProjectCode = projectCodeTest
            };


            List <Task> expected = (List <Task>)broker.returnAllTasksForProject(project);
            List <Task> result   = (List <Task>)taskLogic.returnAllTasksForProject(project);


            Assert.AreEqual(result.Count, expected.Count);
        }
Exemplo n.º 27
0
        public void Test_Submit_Task_Success()
        {
            // Arrange
            _mockTaskRepo.Setup(r => r.ReadAsync(task1.Id)).ReturnsAsync(task1);
            _mockTaskRepo.Setup(r => r.UpdateAsync(task1)).ReturnsAsync(true);
            _mockStudyRepo.Setup(r => r.ReadAsync(study1.Id)).ReturnsAsync(study1);

            var taskLogic = new TaskLogic(_mockTaskRepo.Object, _mockFieldRepo.Object, _mockAnswerRepo.Object, _mockUserRepo.Object, _mockStudyRepo.Object, _mockTaskDelegationRepo.Object, _mockPhaseRepo.Object);

            // Act
            var submitted = taskLogic.SubmitTask(task1).Result;

            // Assert
            Assert.True(submitted);
            Assert.True(task1.IsSubmitted);
        }
        public void updateTask_CanUpdateTask_ReturnTrue()
        {
            var  taskLogic = new TaskLogic();
            Task task      = new Task();

            task.TaskID      = taskIDTest;
            task.ProjectCode = projectCodeTest;
            task.Assignee    = "masa1235";
            task.Status      = 1;
            task.Progress    = Convert.ToDecimal(0.6);
            task.Deadline    = DateTime.Now;
            task.Description = "sasa11";

            var result = taskLogic.updateTask(task);

            Assert.IsTrue(result);
        }
        public void U_createTask_CanCreateTask_ReturnTrue()
        {
            var  taskLogic = new TaskLogic();
            Task task      = new Task();

            task.TaskID      = taskIDTest;
            task.ProjectCode = projectCodeTest;
            task.Assignee    = "jovanjovic";
            task.Status      = 1;
            task.Progress    = Convert.ToDecimal(0.5);
            task.Deadline    = DateTime.Now;
            task.Description = "sasa";

            var result = taskLogic.createTask(task);

            Assert.IsTrue(result);
        }
Exemplo n.º 30
0
        public bool UpdateStatusTask(int taskid, int status)
        {
            Task tst = new Task();
            tst = HibernateHelper.SelectIstance<Task>(new string[] { "Id" }, new object[] { taskid }, new Operators[] { Operators.Eq });
            tst.Status = status;
            tst.DateUpd = DateTime.Now;

            TaskLogic tskSrv = new TaskLogic();
            tst = tskSrv.UpdateTask(tst);
            if (tst.Dirty) {
                //Non è stato modificato
                // Loggare errore
                return false;
            } else {
                //E' stato modificato
                return true;
            }
        }
        public void TestAdd()
        {
            Entities.Task itemToAdd = new Entities.Task();

            itemToAdd.Task_Name   = "TestName_Nunit_1";
            itemToAdd.Parent_Task = "TestParent_Nunit_1";
            itemToAdd.Priority    = 4;
            itemToAdd.Start_Date  = DateTime.Now;
            itemToAdd.End_Date    = DateTime.Now.AddDays(15);
            itemToAdd.Is_End_Task = false;

            TaskLogic businessObject = new TaskLogic();
            int       actualCount    = businessObject.GetAll().Count + 1;

            businessObject.Add(itemToAdd);
            int expectedCount = businessObject.GetAll().Count;

            Assert.AreEqual(actualCount, expectedCount);
        }
Exemplo n.º 32
0
        public void Should_GetTasksFromTheList_WhenGettingTasks()
        {
            //Arrange
            var       taskLogic = new TaskLogic(new TaskContextMock(), _mapper);
            TaskModel task      = new TaskModel {
                Id = 10, TaskType = "GetTest"
            };

            taskLogic.AddTask(task);
            bool found = false;

            //Act
            if (taskLogic.GetTasks()[4].Id == 10 && taskLogic.GetTasks()[4].TaskType == "GetTest")
            {
                found = true;
            }

            //Assert
            Assert.True(found);
        }
Exemplo n.º 33
0
 public List<Task> GetTasks(string where)
 {
     TaskLogic tskSrv = new TaskLogic();
     return tskSrv.GetTasks(where);
 }
Exemplo n.º 34
0
 public List<Task> GetTasks()
 {
     TaskLogic tskSrv = new TaskLogic();
     return tskSrv.GetTasks();
 }