public void CreateUserTask_NonExistentUser_ReturnsNullAndTheTaskAlreadyExistsMessage() { var model = new ResponseModelStub(); string description = "task4"; int userId = 2, existingUserId = 1; bool result = _controller.AddTaskForUser(userId, description, model); Assert.That(result, Is.EqualTo(false)); StringAssert.AreEqualIgnoringCase(model.GetActionResult(), "User not found"); Assert.That(_userDao.GetUser(existingUserId).Tasks.Count, Is.EqualTo(3)); }
public void CreateUserTask_InvalidUserId_ReturnsNullAndInvalidUserIdMessage() { var model = new ResponseModelStub(); string description = "task4"; int userId = -11, existingUserId = 1; bool result = this.controller.AddTaskForUser(userId, description, model); Assert.That(result, Is.EqualTo(false)); StringAssert.AreEqualIgnoringCase(model.GetActionResult(), "Invalid userId"); Assert.That(this.userDao.GetUser(existingUserId).Tasks.Count, Is.EqualTo(3)); }
public void CreateUserTask_ValidData_ReturnsTaskAndEmptyMessage() { var model = new ResponseModelStub(); string description = "task4"; int userId = 1; bool result = _controller.AddTaskForUser(userId, description, model); Assert.That(result, Is.EqualTo(true)); Assert.That(model.GetActionResult(), Is.Null); Assert.That(_userDao.GetUser(userId).Tasks.Count, Is.EqualTo(4)); StringAssert.AreEqualIgnoringCase(_userDao.GetUser(userId).Tasks[3].Description, description); }