Exemple #1
0
        public HttpResponseMessage PutAction(ActionViewModel viewModel)
        {
            UpdateActionResponse response = actionService.UpdateAction(new UpdateActionRequest()
            {
                ActionViewModel = viewModel
            });

            return(Request.BuildResponse(response));
        }
        public void UpdateAction_ValidAction_Succeed()
        {
            ActionViewModel actionViewModel = ActionMockData.GetActionViewModel();

            mockActionRepository.Setup(a => a.Update(new DA.Action())).Verifiable("Unable to delete Action");
            UpdateActionResponse response = actionService.UpdateAction(new UpdateActionRequest()
            {
                ActionViewModel = actionViewModel
            });

            mockRepository.VerifyAll();
        }
        public void UpdateAction_InValidAction_BrokenRules()
        {
            ActionViewModel actionViewModel = ActionMockData.GetActionViewModel();

            mockActionRepository.Setup(a => a.Update(new DA.Action())).Throws(new NullReferenceException());
            UpdateActionResponse response = actionService.UpdateAction(new UpdateActionRequest()
            {
                ActionViewModel = actionViewModel
            });

            mockRepository.VerifyAll();
            Assert.AreEqual(typeof(NullReferenceException), response.Exception.GetType());
            Assert.AreNotEqual(null, response.Exception);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            UpdateActionResponse response = new UpdateActionResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("ActionArn", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ActionArn = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }