Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> AddGoal([FromBody] AddGoalRequest request)
        {
            var response = await orchestrator.AddGoal(request);

            return(Ok(response));
        }