public void AddGoal_InvalidParams_ReturnsErrorResponse() { var test = orchestrator.AddGoal(invalidGoalViewModel, validUsername).Result; Assert.IsInstanceOf <OrchestratorResponseWrapper <GoalViewModel> >(test); Assert.IsNotNull(test); Assert.IsNull(test.Model); Assert.AreEqual(1, test.Errors.Count); }
public void AddGoal_ValidParams_ReturnsResponse() { var test = orchestrator.AddGoal(validAddGoalRequest).Result; Assert.IsNotNull(test); Assert.IsInstanceOf <AddGoalResponse>(test); Assert.IsTrue(test.Success); Assert.IsNotNull(test.Goal); }
public async Task <ActionResult> Add(GoalViewModel model) { if (!ModelState.IsValid) { return(InvalidModelState(ModelState)); } model.UserId = UserId; var response = await orchestrator.AddGoal(model, UserEmail); return(JsonResponse(response)); }
public async Task <IHttpActionResult> AddGoal([FromBody] AddGoalRequest request) { var response = await orchestrator.AddGoal(request); return(Ok(response)); }