예제 #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DeleteProjectResponse response = new DeleteProjectResponse();


            return(response);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>  
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DeleteProjectResponse response = new DeleteProjectResponse();


            return response;
        }
예제 #3
0
        public async Task DeleteProjectAsync_ValidRequest_ShouldReturnDeletedProject()
        {
            // Arrange
            var existingProject = new GetProjectPayload
            {
                Id = Guid.NewGuid().ToString(),
            };

            var expectedResponseContent =
                new StringContent(JsonConvert.SerializeObject(existingProject, this.fixture.JsonSerializerSettings));

            var expectedResponse = new HttpResponseMessage
            {
                Content = expectedResponseContent,
            };

            var projectApi = this.fixture.GetProjectApi(expectedResponse);

            var deleteProjectResponse = new DeleteProjectResponse();

            // Act
            Func <Task> act = async() => deleteProjectResponse = await projectApi.DeleteProjectAsync(existingProject.Id);

            // Assert
            await act.Should().NotThrowAsync();

            deleteProjectResponse.Id.Should().Be(existingProject.Id);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DeleteProjectResponse response = new DeleteProjectResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("deletedResources", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Resource, ResourceUnmarshaller>(ResourceUnmarshaller.Instance);
                    response.DeletedResources = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("orphanedResources", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Resource, ResourceUnmarshaller>(ResourceUnmarshaller.Instance);
                    response.OrphanedResources = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DeleteProjectResponse response = new DeleteProjectResponse();

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

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

            return(response);
        }
예제 #6
0
        public async Task <IActionResult> DeleteProject(long projectId)
        {
            var deleteProjectResponse  = new DeleteProjectResponse();
            var commandHandlerResponse = await _projectMediator.Send(new DeleteProjectRequest { ProjectId = projectId });

            deleteProjectResponse.HandleSuccess(commandHandlerResponse);
            return(Ok(deleteProjectResponse));
        }
예제 #7
0
        public static DeleteProjectResponse Unmarshall(UnmarshallerContext _ctx)
        {
            DeleteProjectResponse deleteProjectResponse = new DeleteProjectResponse();

            deleteProjectResponse.HttpResponse = _ctx.HttpResponse;
            deleteProjectResponse.RequestId    = _ctx.StringValue("DeleteProject.RequestId");

            return(deleteProjectResponse);
        }
        public static DeleteProjectResponse Unmarshall(UnmarshallerContext context)
        {
            DeleteProjectResponse deleteProjectResponse = new DeleteProjectResponse();

            deleteProjectResponse.HttpResponse = context.HttpResponse;
            deleteProjectResponse.Code         = context.IntegerValue("DeleteProject.Code");
            deleteProjectResponse.Message      = context.StringValue("DeleteProject.Message");
            deleteProjectResponse.RequestId    = context.StringValue("DeleteProject.RequestId");

            return(deleteProjectResponse);
        }
예제 #9
0
        public static DeleteProjectResponse Unmarshall(UnmarshallerContext context)
        {
            DeleteProjectResponse deleteProjectResponse = new DeleteProjectResponse();

            deleteProjectResponse.HttpResponse = context.HttpResponse;
            deleteProjectResponse.RequestId    = context.StringValue("DeleteProject.RequestId");
            deleteProjectResponse.Success      = context.BooleanValue("DeleteProject.Success");
            deleteProjectResponse.ErrMessage   = context.StringValue("DeleteProject.ErrMessage");

            return(deleteProjectResponse);
        }
        public DeleteProjectResponse DeleteProject(DeleteProjectRequest project, UnitOfWork context)
        {
            var response = new DeleteProjectResponse();

            var projectDb = context.Projects.GetItem(project.Id);

            foreach (var task in projectDb.Tasks)
            {
                context.Tasks.RemoveItem(task);
            }

            response.Count = context.Projects.RemoveItem(_mapper.Map <Project>(project));

            return(response);
        }