コード例 #1
0
        public void FinderulesInStaticMethods()
        {
            var model    = new Model5();
            var property = model.GetType().GetProperty(nameof(model.Text));
            var rules    = this.sut.GetRulesForProperty(model.GetType(), property, RuleType.Default);

            Assert.IsNotNull(rules);
            Assert.IsTrue(rules.Any());
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="idrule"></param>
        /// <param name="body"> (optional)</param>
        /// <returns>Task of ApiResponse (string)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <string> > PostExecuteV1RuleIdruleAsyncWithHttpInfo(string idrule, Model5 body = null)
        {
            // verify the required parameter 'idrule' is set
            if (idrule == null)
            {
                throw new ApiException(400, "Missing required parameter 'idrule' when calling ExecuteApi->PostExecuteV1RuleIdrule");
            }

            var    localVarPath         = "/execute/v1/rule/{idrule}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };
            String localVarHttpContentType    = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
            };
            String localVarHttpHeaderAccept    = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (idrule != null)
            {
                localVarPathParams.Add("idrule", this.Configuration.ApiClient.ParameterToString(idrule));                 // path parameter
            }
            if (body != null && body.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter
            }
            else
            {
                localVarPostBody = body; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("PostExecuteV1RuleIdrule", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <string>(localVarStatusCode,
                                            localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                            (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))));
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="domain"></param>
        /// <param name="key"></param>
        /// <param name="body"> (optional)</param>
        /// <returns>ApiResponse of string</returns>
        public ApiResponse <string> PostExecuteV1LocalDomainKeyWithHttpInfo(string domain, string key, Model5 body = null)
        {
            // verify the required parameter 'domain' is set
            if (domain == null)
            {
                throw new ApiException(400, "Missing required parameter 'domain' when calling ExecuteApi->PostExecuteV1LocalDomainKey");
            }
            // verify the required parameter 'key' is set
            if (key == null)
            {
                throw new ApiException(400, "Missing required parameter 'key' when calling ExecuteApi->PostExecuteV1LocalDomainKey");
            }

            var    localVarPath         = "/execute/v1/local/{domain}/{key}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };
            String localVarHttpContentType    = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
            };
            String localVarHttpHeaderAccept    = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (domain != null)
            {
                localVarPathParams.Add("domain", this.Configuration.ApiClient.ParameterToString(domain));                 // path parameter
            }
            if (key != null)
            {
                localVarPathParams.Add("key", this.Configuration.ApiClient.ParameterToString(key));              // path parameter
            }
            if (body != null && body.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter
            }
            else
            {
                localVarPostBody = body; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
                                                                                                 Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                 localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("PostExecuteV1LocalDomainKey", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <string>(localVarStatusCode,
                                            localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                            (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))));
        }