Ejemplo n.º 1
0
        public async Task AddTaskCollaborators()
        {
            var newUser = new ManagemAntsServer.Dbo.User()
            {
                Pseudo    = "ThisIsANewPseudoTask",
                Firstname = "ThisIsANewFirstanameTask",
                Lastname  = "ThisIsANewLastnameTask",
                Password  = "******"
            };
            var resultUser = await _loginController.SignUp(newUser) as Microsoft.AspNetCore.Mvc.OkObjectResult;

            var user = (resultUser.Value as List <ManagemAntsServer.Dbo.User>).FirstOrDefault();
            var task = _refFixture.Tasks[0];

            var newUserHasTask = new ManagemAntsServer.Dbo.UsersHasTask()
            {
                UserId = user.Id,
                TaskId = task.Id
            };

            var result = await _taskController.AddTaskCollaborators(newUserHasTask) as Microsoft.AspNetCore.Mvc.OkObjectResult;

            Assert.AreEqual(200, result.StatusCode);

            var userHasTask = result.Value as ManagemAntsServer.Dbo.UsersHasTask;

            Assert.IsTrue(TaskUtils.IsEqualUserHasTasks(newUserHasTask, userHasTask));
        }