Beispiel #1
0
        // GET: Category/Details/5
        public ActionResult Details(int id)
        {
            var cat = Ts.GetById(id);


            TasksViewModel cvm = new TasksViewModel();

            cvm.projectname = cat.proj.projectname;
            cvm.membname    = cat.team_member.firstName + " " + cat.team_member.lastName;
            cvm.diffname    = cat.Difficultes.Nomdiff;
            cvm.nomtask     = cat.nomtask;
            cvm.membemail   = cat.team_member.Email;
            return(View(cvm));
        }
        public void TasksService_GetById()
        {
            _repository.Setup(x => x.GetById(It.IsAny <Guid>())).Returns(_taskOne);
            var expected = _tasksService.GetById(Guid.NewGuid());

            _repository.Verify(x => x.GetById(It.IsAny <Guid>()));
        }
Beispiel #3
0
 public ActionResult <Tasky> Get(int id)
 {
     try
     {
         return(Ok(_ts.GetById(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Beispiel #4
0
        public void GetByIdShouldReturnTaskWithCorrectId()
        {
            var options = new DbContextOptionsBuilder <TasksDbContext>()
                          .UseInMemoryDatabase(databaseName: nameof(GetByIdShouldReturnTaskWithCorrectId))
                          .Options;

            using (var context = new TasksDbContext(options))
            {
                var taskService = new TasksService(context);
                var added       = new TaskPostDTO()

                {
                    Title          = "BookingNOW",
                    Description    = "Verify booking commision",
                    DateAdded      = DateTime.Parse("2019-06-15T00:00:00"),
                    Deadline       = DateTime.Parse("2019-06-17T00:00:00"),
                    TaskImportance = "High",
                    TaskState      = "Closed",
                    DateClosed     = null,

                    Comments = new List <Comment>()
                    {
                        new Comment
                        {
                            Important = true,
                            Text      = "A nice task...",
                        }
                    },
                };

                var current  = taskService.Create(added, null);
                var expected = taskService.GetById(current.Id);

                Assert.IsNotNull(expected);
                Assert.AreEqual(expected.Title, current.Title);
                Assert.AreEqual(expected.Description, current.Description);
                Assert.AreEqual(expected.TaskImportance, current.TaskImportance);
                Assert.AreEqual(expected.TaskState, current.TaskState);
                Assert.AreEqual(expected.Id, current.Id);
            }
        }
Beispiel #5
0
 public Task GetById(int taskId)
 {
     return(service.GetById(taskId));
 }