forked from loafle/openapi-generator-original
[csharp] Remove enum-ref integration test
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
package io.swagger.codegen.csharp;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.swagger.codegen.AbstractIntegrationTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.CSharpClientCodegen;
|
||||
import io.swagger.codegen.testutils.IntegrationTestPathsConfig;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CsharpClientEnumRefIntegrationTest extends AbstractIntegrationTest {
|
||||
public CsharpClientEnumRefIntegrationTest() {
|
||||
generateSwaggerMetadata = false;
|
||||
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
systemPropertyOverrides = builder
|
||||
.put(CodegenConstants.APIS, Boolean.FALSE.toString())
|
||||
.put(CodegenConstants.MODELS, Boolean.TRUE.toString())
|
||||
.put(CodegenConstants.API_DOCS, Boolean.FALSE.toString())
|
||||
.put(CodegenConstants.MODEL_DOCS, Boolean.FALSE.toString())
|
||||
.put(CodegenConstants.API_TESTS, Boolean.FALSE.toString())
|
||||
.put(CodegenConstants.MODEL_TESTS, Boolean.FALSE.toString())
|
||||
.put(CodegenConstants.SUPPORTING_FILES, Boolean.FALSE.toString())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IntegrationTestPathsConfig getIntegrationTestPathsConfig() {
|
||||
return new IntegrationTestPathsConfig("csharp/general/enum-ref");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return new CSharpClientCodegen();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> configProperties() {
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
properties.put(CodegenConstants.EXCLUDE_TESTS, Boolean.TRUE.toString());
|
||||
return properties;
|
||||
}
|
||||
|
||||
// TODO: Remove this when super.generatesCorrectDirectoryStructure() is re-enabled.
|
||||
@Test(description = "Verify csharp enums as ref properties")
|
||||
public void test() throws IOException {
|
||||
this.generatesCorrectDirectoryStructure();
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
/*
|
||||
* My title
|
||||
*
|
||||
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
||||
*
|
||||
* OpenAPI spec version: 1
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
|
||||
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// MyClassWithOptionalEnum
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class MyClassWithOptionalEnum : IEquatable<MyClassWithOptionalEnum>, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets Days
|
||||
/// </summary>
|
||||
[DataMember(Name="days", EmitDefaultValue=false)]
|
||||
public WeekDays? Days { get; set; }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MyClassWithOptionalEnum" /> class.
|
||||
/// </summary>
|
||||
/// <param name="Quarantine">Quarantine.</param>
|
||||
/// <param name="Grayware">Grayware.</param>
|
||||
/// <param name="Days">Days.</param>
|
||||
public MyClassWithOptionalEnum(bool? Quarantine = default(bool?), bool? Grayware = default(bool?), WeekDays? Days = default(WeekDays?))
|
||||
{
|
||||
this.Quarantine = Quarantine;
|
||||
this.Grayware = Grayware;
|
||||
this.Days = Days;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quarantine
|
||||
/// </summary>
|
||||
[DataMember(Name="quarantine", EmitDefaultValue=false)]
|
||||
public bool? Quarantine { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Grayware
|
||||
/// </summary>
|
||||
[DataMember(Name="grayware", EmitDefaultValue=false)]
|
||||
public bool? Grayware { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class MyClassWithOptionalEnum {\n");
|
||||
sb.Append(" Quarantine: ").Append(Quarantine).Append("\n");
|
||||
sb.Append(" Grayware: ").Append(Grayware).Append("\n");
|
||||
sb.Append(" Days: ").Append(Days).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object input)
|
||||
{
|
||||
return this.Equals(input as MyClassWithOptionalEnum);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if MyClassWithOptionalEnum instances are equal
|
||||
/// </summary>
|
||||
/// <param name="input">Instance of MyClassWithOptionalEnum to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(MyClassWithOptionalEnum input)
|
||||
{
|
||||
if (input == null)
|
||||
return false;
|
||||
|
||||
return
|
||||
(
|
||||
this.Quarantine == input.Quarantine ||
|
||||
(this.Quarantine != null &&
|
||||
this.Quarantine.Equals(input.Quarantine))
|
||||
) &&
|
||||
(
|
||||
this.Grayware == input.Grayware ||
|
||||
(this.Grayware != null &&
|
||||
this.Grayware.Equals(input.Grayware))
|
||||
) &&
|
||||
(
|
||||
this.Days == input.Days ||
|
||||
(this.Days != null &&
|
||||
this.Days.Equals(input.Days))
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
int hashCode = 41;
|
||||
if (this.Quarantine != null)
|
||||
hashCode = hashCode * 59 + this.Quarantine.GetHashCode();
|
||||
if (this.Grayware != null)
|
||||
hashCode = hashCode * 59 + this.Grayware.GetHashCode();
|
||||
if (this.Days != null)
|
||||
hashCode = hashCode * 59 + this.Days.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To validate all properties of the instance
|
||||
/// </summary>
|
||||
/// <param name="validationContext">Validation context</param>
|
||||
/// <returns>Validation Result</returns>
|
||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* My title
|
||||
*
|
||||
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
||||
*
|
||||
* OpenAPI spec version: 1
|
||||
*
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
|
||||
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines WeekDays
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum WeekDays
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum Sun for "sun"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "sun")]
|
||||
Sun,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Mon for "mon"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "mon")]
|
||||
Mon,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Tue for "tue"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "tue")]
|
||||
Tue,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Wed for "wed"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "wed")]
|
||||
Wed,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Thu for "thu"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "thu")]
|
||||
Thu,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Fri for "fri"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "fri")]
|
||||
Fri,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Sat for "sat"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "sat")]
|
||||
Sat
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"version": "1",
|
||||
"title": "My title"
|
||||
},
|
||||
"host": "localhost:10010",
|
||||
"basePath": "/",
|
||||
"schemes": [
|
||||
"http",
|
||||
"https"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"operationId": "getRoot",
|
||||
"summary": "Root operation",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "200 OK Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"WeekDays": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"sun",
|
||||
"mon",
|
||||
"tue",
|
||||
"wed",
|
||||
"thu",
|
||||
"fri",
|
||||
"sat"
|
||||
]
|
||||
},
|
||||
"My_Class_With_Optional_Enum": {
|
||||
"properties": {
|
||||
"quarantine": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"grayware": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"days": {
|
||||
"$ref": "#/definitions/WeekDays"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
!**/IO.Swagger/Model/*.cs
|
||||
**/Api/
|
||||
**/Client/
|
||||
**/Properties
|
||||
**/IO.Swagger.Test/
|
||||
**/*
|
||||
*/*
|
||||
.swagger-codegen/
|
||||
*/.*
|
||||
Reference in New Issue
Block a user