public HttpResponseMessage Test([FromBody] TestRequest request) { switch (request.ReturnHttpStatusCode) { case (int)HttpStatusCode.OK: return(this.Request.CreateResponse(new OkResponseStatus <TestResponse>(new TestResponse()))); case (int)HttpStatusCode.InternalServerError: return(this.Request.CreateResponse(new ErrorResponseStatus <TestResponse>(new InternalServerResponseError()))); case (int)HttpStatusCode.BadRequest: var error = new InvalidArgumentsResponseError(new List <ResponseArgumentError> { new ResponseArgumentError ( ArgumentName <TestRequest> .For(r => r.Val1), new ArgumentErrorStub() ), new ResponseArgumentError ( ArgumentName <TestRequest> .For(r => r.Val2), new ArgumentErrorStub() ) }); return(this.Request.CreateResponse(new ErrorResponseStatus <TestResponse>(error))); } throw new ArgumentOutOfRangeException("Http Status Code:" + request.ReturnHttpStatusCode + ". Not supported."); }
public bool Equals(AttributeArgument compareNode) { return (compareNode != null && ArgumentName?.Equals(compareNode.ArgumentName) != false && ArgumentExpression?.Equals(compareNode.ArgumentExpression) != false && base.Equals(compareNode)); }
protected override object DoVisit(ArgumentName argumentName) { if (!arguments.Contains(argumentName.Name)) { errorLogger.LogError( argumentName.Location, Utilities.InvariantFormat("Argument with name \"{0}\" doesn't exist.", argumentName.Name)); return(Error); } return(arguments[argumentName.Name].Value); }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> /// <filterpriority>2</filterpriority> public override Int32 GetHashCode() { unchecked { var hashCode = IsOptional.GetHashCode(); hashCode = (hashCode * 397) ^ (DefaultValue != null ? DefaultValue.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ArgumentType != null ? ArgumentType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ArgumentName != null ? ArgumentName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Position.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = Name.GetHashCode(); hashCode = (hashCode * 397) ^ ArgumentName.GetHashCode(); hashCode = (hashCode * 397) ^ TypeFullyQualifiedWithNullability.GetHashCode(); hashCode = (hashCode * 397) ^ IsStatic.GetHashCode(); hashCode = (hashCode * 397) ^ SpecialType.GetHashCode(); hashCode = (hashCode * 397) ^ IsReferenceType.GetHashCode(); return(hashCode); } }
private FieldDefinitionNode RewriteArgument( NameString schemaName, FieldDefinitionNode field) { var renamedArguments = new List <InputValueDefinitionNode>(); foreach (InputValueDefinitionNode argument in field.Arguments) { if (ArgumentName.Equals(argument.Name.Value)) { renamedArguments.Add(argument.Rename( NewArgumentName, schemaName)); } else { renamedArguments.Add(argument); } } return(field.WithArguments(renamedArguments)); }
protected override bool CheckArgument() { return(CommandLineArgs.IsPresent(ArgumentName.ToLowerInvariant())); }
public object Visit(ArgumentName argumentName) { return(DoVisit(Utilities.ThrowIfNull(argumentName, "argumentName"))); }
protected virtual object DoVisit(ArgumentName argumentName) { return(Default(argumentName)); }