public void SetUp()
        {
            _pipelineMock = new Mock <IPipeline>(MockBehavior.Strict);

            _pipelinesService = new PipelinesService();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets up HTTP methods mappings.
        /// </summary>
        /// <param name="service">Service handling requests</param>
        public PipelinesModule(PipelinesService service) : base("/")
        {
            Delete["/api/program/{programId}/pipeline/{pipelineId}"] = parameters =>
            {
                var programId     = Parameters.ValueOf <string>(parameters, Context.Request, "programId", ParameterType.Path);
                var pipelineId    = Parameters.ValueOf <string>(parameters, Context.Request, "pipelineId", ParameterType.Path);
                var xGwImsOrgId   = Parameters.ValueOf <string>(parameters, Context.Request, "xGwImsOrgId", ParameterType.Header);
                var authorization = Parameters.ValueOf <string>(parameters, Context.Request, "authorization", ParameterType.Header);
                var xApiKey       = Parameters.ValueOf <string>(parameters, Context.Request, "xApiKey", ParameterType.Header);
                Preconditions.IsNotNull(programId, "Required parameter: 'programId' is missing at 'DeletePipeline'");

                Preconditions.IsNotNull(pipelineId, "Required parameter: 'pipelineId' is missing at 'DeletePipeline'");

                Preconditions.IsNotNull(xGwImsOrgId, "Required parameter: 'xGwImsOrgId' is missing at 'DeletePipeline'");

                Preconditions.IsNotNull(authorization, "Required parameter: 'authorization' is missing at 'DeletePipeline'");

                Preconditions.IsNotNull(xApiKey, "Required parameter: 'xApiKey' is missing at 'DeletePipeline'");

                service.DeletePipeline(Context, programId, pipelineId, xGwImsOrgId, authorization, xApiKey);
                return(new Response {
                    ContentType = ""
                });
            };

            Get["/api/program/{programId}/pipeline/{pipelineId}"] = parameters =>
            {
                var programId     = Parameters.ValueOf <string>(parameters, Context.Request, "programId", ParameterType.Path);
                var pipelineId    = Parameters.ValueOf <string>(parameters, Context.Request, "pipelineId", ParameterType.Path);
                var xGwImsOrgId   = Parameters.ValueOf <string>(parameters, Context.Request, "xGwImsOrgId", ParameterType.Header);
                var authorization = Parameters.ValueOf <string>(parameters, Context.Request, "authorization", ParameterType.Header);
                var xApiKey       = Parameters.ValueOf <string>(parameters, Context.Request, "xApiKey", ParameterType.Header);
                Preconditions.IsNotNull(programId, "Required parameter: 'programId' is missing at 'GetPipeline'");

                Preconditions.IsNotNull(pipelineId, "Required parameter: 'pipelineId' is missing at 'GetPipeline'");

                Preconditions.IsNotNull(xGwImsOrgId, "Required parameter: 'xGwImsOrgId' is missing at 'GetPipeline'");

                Preconditions.IsNotNull(authorization, "Required parameter: 'authorization' is missing at 'GetPipeline'");

                Preconditions.IsNotNull(xApiKey, "Required parameter: 'xApiKey' is missing at 'GetPipeline'");

                return(service.GetPipeline(Context, programId, pipelineId, xGwImsOrgId, authorization, xApiKey));
            };

            Get["/api/program/{programId}/pipelines"] = parameters =>
            {
                var programId     = Parameters.ValueOf <string>(parameters, Context.Request, "programId", ParameterType.Path);
                var xGwImsOrgId   = Parameters.ValueOf <string>(parameters, Context.Request, "xGwImsOrgId", ParameterType.Header);
                var authorization = Parameters.ValueOf <string>(parameters, Context.Request, "authorization", ParameterType.Header);
                var xApiKey       = Parameters.ValueOf <string>(parameters, Context.Request, "xApiKey", ParameterType.Header);
                Preconditions.IsNotNull(programId, "Required parameter: 'programId' is missing at 'GetPipelines'");

                Preconditions.IsNotNull(xGwImsOrgId, "Required parameter: 'xGwImsOrgId' is missing at 'GetPipelines'");

                Preconditions.IsNotNull(authorization, "Required parameter: 'authorization' is missing at 'GetPipelines'");

                Preconditions.IsNotNull(xApiKey, "Required parameter: 'xApiKey' is missing at 'GetPipelines'");

                return(service.GetPipelines(Context, programId, xGwImsOrgId, authorization, xApiKey));
            };

            Patch["/api/program/{programId}/pipeline/{pipelineId}"] = parameters =>
            {
                var programId     = Parameters.ValueOf <string>(parameters, Context.Request, "programId", ParameterType.Path);
                var pipelineId    = Parameters.ValueOf <string>(parameters, Context.Request, "pipelineId", ParameterType.Path);
                var xGwImsOrgId   = Parameters.ValueOf <string>(parameters, Context.Request, "xGwImsOrgId", ParameterType.Header);
                var authorization = Parameters.ValueOf <string>(parameters, Context.Request, "authorization", ParameterType.Header);
                var xApiKey       = Parameters.ValueOf <string>(parameters, Context.Request, "xApiKey", ParameterType.Header);
                var contentType   = Parameters.ValueOf <string>(parameters, Context.Request, "contentType", ParameterType.Header);
                var body          = this.Bind <Pipeline>();
                Preconditions.IsNotNull(programId, "Required parameter: 'programId' is missing at 'PatchPipeline'");

                Preconditions.IsNotNull(pipelineId, "Required parameter: 'pipelineId' is missing at 'PatchPipeline'");

                Preconditions.IsNotNull(xGwImsOrgId, "Required parameter: 'xGwImsOrgId' is missing at 'PatchPipeline'");

                Preconditions.IsNotNull(authorization, "Required parameter: 'authorization' is missing at 'PatchPipeline'");

                Preconditions.IsNotNull(xApiKey, "Required parameter: 'xApiKey' is missing at 'PatchPipeline'");

                Preconditions.IsNotNull(contentType, "Required parameter: 'contentType' is missing at 'PatchPipeline'");

                Preconditions.IsNotNull(body, "Required parameter: 'body' is missing at 'PatchPipeline'");

                return(service.PatchPipeline(Context, programId, pipelineId, xGwImsOrgId, authorization, xApiKey, contentType, body));
            };
        }