public static string Number(string name, OpenApiSchema schema, bool useForBadRequest) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (schema == null) { throw new ArgumentNullException(nameof(schema)); } if (useForBadRequest) { return("@"); } if (name.Equals("Id", StringComparison.OrdinalIgnoreCase) || name.EndsWith("Id", StringComparison.Ordinal)) { return("27"); } return(schema.Type switch { OpenApiDataTypeConstants.Number when !schema.HasFormatType() => CreateNumberDouble(schema), OpenApiDataTypeConstants.Integer when schema.HasFormatType() && schema.IsFormatTypeOfInt64() => CreateNumberLong(schema), _ => CreateNumberInt(schema) });
public void HasFormatType(bool expected, OpenApiSchema openApiSchema) { // Act var actual = openApiSchema.HasFormatType(); // Assert Assert.Equal(expected, actual); }