diff --git a/modules/swagger-codegen/src/main/resources/csharp/model.mustache b/modules/swagger-codegen/src/main/resources/csharp/model.mustache
index d40ece4cc02..7ab48dc56e2 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/model.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/model.mustache
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
@@ -8,46 +9,103 @@ using Newtonsoft.Json;
{{#models}}
{{#model}}
-namespace {{packageName}}.Model {
-
- ///
- /// {{description}}
- ///
- [DataContract]
- public class {{classname}}{{#parent}} : {{{parent}}}{{/parent}} {
- {{#vars}}
- ///
- /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
- /// {{#description}}
- /// {{{description}}}{{/description}}
- [DataMember(Name="{{baseName}}", EmitDefaultValue=false)]
- public {{{datatype}}} {{name}} { get; set; }
-
- {{/vars}}
+namespace {{packageName}}.Model
+{
///
- /// Get the string presentation of the object
+ /// {{description}}
///
- /// String presentation of the object
- public override string ToString() {
- var sb = new StringBuilder();
- sb.Append("class {{classname}} {\n");
- {{#vars}}
- sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
- {{/vars}}
- sb.Append("}\n");
- return sb.ToString();
- }
+ [DataContract]
+ public class {{classname}} : IEquatable<{{classname}}>{{#parent}}, {{{parent}}}{{/parent}}
+ {
+ {{#vars}}
+ ///
+ /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
+ /// {{#description}}
+ /// {{{description}}}{{/description}}
+ [DataMember(Name="{{baseName}}", EmitDefaultValue=false)]
+ public {{{datatype}}} {{name}} { get; set; }
+
+ {{/vars}}
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class {{classname}} {\n");
+ {{#vars}}sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
+ {{/vars}}
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public {{#parent}} new {{/parent}}string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
- ///
- /// Get the JSON string presentation of the object
- ///
- /// JSON string presentation of the object
- public {{#parent}} new {{/parent}}string ToJson() {
- return JsonConvert.SerializeObject(this, Formatting.Indented);
- }
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object obj)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ return this.Equals(obj as {{classname}});
+ }
-}
+ ///
+ /// Returns true if {{classname}} instances are equal
+ ///
+ /// Instance of {{classname}} to be compared
+ /// Boolean
+ public bool Equals({{classname}} other)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ if (other == null)
+ return false;
+
+ return {{#vars}}{{#isNotContainer}}
+ (
+ this.{{name}} == other.{{name}} ||
+ this.{{name}} != null &&
+ this.{{name}}.Equals(other.{{name}})
+ ){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{^isNotContainer}}
+ (
+ this.{{name}} == other.{{name}} ||
+ this.{{name}} != null &&
+ this.{{name}}.SequenceEqual(other.{{name}})
+ ){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{/vars}};
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ // credit: http://stackoverflow.com/a/263416/677735
+ unchecked // Overflow is fine, just wrap
+ {
+ int hash = 41;
+ // Suitable nullity checks etc, of course :)
+ {{#vars}}
+ if (this.{{name}} != null)
+ hash = hash * 57 + this.{{name}}.GetHashCode();
+ {{/vars}}
+ return hash;
+ }
+ }
+
+ }
{{/model}}
{{/models}}
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs
index 56ebfdb3b7b..7d3f0936dce 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
@@ -6,52 +7,111 @@ using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
-namespace IO.Swagger.Model {
-
- ///
- ///
- ///
- [DataContract]
- public class Category {
-
- ///
- /// Gets or Sets Id
- ///
- [DataMember(Name="id", EmitDefaultValue=false)]
- public long? Id { get; set; }
-
-
- ///
- /// Gets or Sets Name
- ///
- [DataMember(Name="name", EmitDefaultValue=false)]
- public string Name { get; set; }
-
-
+namespace IO.Swagger.Model
+{
///
- /// Get the string presentation of the object
+ ///
///
- /// String presentation of the object
- public override string ToString() {
- var sb = new StringBuilder();
- sb.Append("class Category {\n");
-
- sb.Append(" Id: ").Append(Id).Append("\n");
-
- sb.Append(" Name: ").Append(Name).Append("\n");
-
- sb.Append("}\n");
- return sb.ToString();
+ [DataContract]
+ public class Category : IEquatable
+ {
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [DataMember(Name="id", EmitDefaultValue=false)]
+ public long? Id { get; set; }
+
+
+ ///
+ /// Gets or Sets Name
+ ///
+ [DataMember(Name="name", EmitDefaultValue=false)]
+ public string Name { get; set; }
+
+
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class Category {\n");
+ sb.Append(" Id: ").Append(Id).Append("\n");
+ sb.Append(" Name: ").Append(Name).Append("\n");
+
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object obj)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ return this.Equals(obj as Category);
+ }
+
+ ///
+ /// Returns true if Category instances are equal
+ ///
+ /// Instance of Category to be compared
+ /// Boolean
+ public bool Equals(Category other)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ if (other == null)
+ return false;
+
+ return
+ (
+ this.Id == other.Id ||
+ this.Id != null &&
+ this.Id.Equals(other.Id)
+ ) &&
+ (
+ this.Name == other.Name ||
+ this.Name != null &&
+ this.Name.Equals(other.Name)
+ );
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ // credit: http://stackoverflow.com/a/263416/677735
+ unchecked // Overflow is fine, just wrap
+ {
+ int hash = 41;
+ // Suitable nullity checks etc, of course :)
+
+ if (this.Id != null)
+ hash = hash * 57 + this.Id.GetHashCode();
+
+ if (this.Name != null)
+ hash = hash * 57 + this.Name.GetHashCode();
+
+ return hash;
+ }
+ }
+
}
-
- ///
- /// Get the JSON string presentation of the object
- ///
- /// JSON string presentation of the object
- public string ToJson() {
- return JsonConvert.SerializeObject(this, Formatting.Indented);
- }
-
-}
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs
index 1fa62c1605a..1f786769d55 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
@@ -6,89 +7,176 @@ using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
-namespace IO.Swagger.Model {
-
- ///
- ///
- ///
- [DataContract]
- public class Order {
-
- ///
- /// Gets or Sets Id
- ///
- [DataMember(Name="id", EmitDefaultValue=false)]
- public long? Id { get; set; }
-
-
- ///
- /// Gets or Sets PetId
- ///
- [DataMember(Name="petId", EmitDefaultValue=false)]
- public long? PetId { get; set; }
-
-
- ///
- /// Gets or Sets Quantity
- ///
- [DataMember(Name="quantity", EmitDefaultValue=false)]
- public int? Quantity { get; set; }
-
-
- ///
- /// Gets or Sets ShipDate
- ///
- [DataMember(Name="shipDate", EmitDefaultValue=false)]
- public DateTime? ShipDate { get; set; }
-
-
- ///
- /// Order Status
- ///
- /// Order Status
- [DataMember(Name="status", EmitDefaultValue=false)]
- public string Status { get; set; }
-
-
- ///
- /// Gets or Sets Complete
- ///
- [DataMember(Name="complete", EmitDefaultValue=false)]
- public bool? Complete { get; set; }
-
-
+namespace IO.Swagger.Model
+{
///
- /// Get the string presentation of the object
+ ///
///
- /// String presentation of the object
- public override string ToString() {
- var sb = new StringBuilder();
- sb.Append("class Order {\n");
-
- sb.Append(" Id: ").Append(Id).Append("\n");
-
- sb.Append(" PetId: ").Append(PetId).Append("\n");
-
- sb.Append(" Quantity: ").Append(Quantity).Append("\n");
-
- sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
-
- sb.Append(" Status: ").Append(Status).Append("\n");
-
- sb.Append(" Complete: ").Append(Complete).Append("\n");
-
- sb.Append("}\n");
- return sb.ToString();
+ [DataContract]
+ public class Order : IEquatable
+ {
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [DataMember(Name="id", EmitDefaultValue=false)]
+ public long? Id { get; set; }
+
+
+ ///
+ /// Gets or Sets PetId
+ ///
+ [DataMember(Name="petId", EmitDefaultValue=false)]
+ public long? PetId { get; set; }
+
+
+ ///
+ /// Gets or Sets Quantity
+ ///
+ [DataMember(Name="quantity", EmitDefaultValue=false)]
+ public int? Quantity { get; set; }
+
+
+ ///
+ /// Gets or Sets ShipDate
+ ///
+ [DataMember(Name="shipDate", EmitDefaultValue=false)]
+ public DateTime? ShipDate { get; set; }
+
+
+ ///
+ /// Order Status
+ ///
+ /// Order Status
+ [DataMember(Name="status", EmitDefaultValue=false)]
+ public string Status { get; set; }
+
+
+ ///
+ /// Gets or Sets Complete
+ ///
+ [DataMember(Name="complete", EmitDefaultValue=false)]
+ public bool? Complete { get; set; }
+
+
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class Order {\n");
+ sb.Append(" Id: ").Append(Id).Append("\n");
+ sb.Append(" PetId: ").Append(PetId).Append("\n");
+ sb.Append(" Quantity: ").Append(Quantity).Append("\n");
+ sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
+ sb.Append(" Status: ").Append(Status).Append("\n");
+ sb.Append(" Complete: ").Append(Complete).Append("\n");
+
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object obj)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ return this.Equals(obj as Order);
+ }
+
+ ///
+ /// Returns true if Order instances are equal
+ ///
+ /// Instance of Order to be compared
+ /// Boolean
+ public bool Equals(Order other)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ if (other == null)
+ return false;
+
+ return
+ (
+ this.Id == other.Id ||
+ this.Id != null &&
+ this.Id.Equals(other.Id)
+ ) &&
+ (
+ this.PetId == other.PetId ||
+ this.PetId != null &&
+ this.PetId.Equals(other.PetId)
+ ) &&
+ (
+ this.Quantity == other.Quantity ||
+ this.Quantity != null &&
+ this.Quantity.Equals(other.Quantity)
+ ) &&
+ (
+ this.ShipDate == other.ShipDate ||
+ this.ShipDate != null &&
+ this.ShipDate.Equals(other.ShipDate)
+ ) &&
+ (
+ this.Status == other.Status ||
+ this.Status != null &&
+ this.Status.Equals(other.Status)
+ ) &&
+ (
+ this.Complete == other.Complete ||
+ this.Complete != null &&
+ this.Complete.Equals(other.Complete)
+ );
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ // credit: http://stackoverflow.com/a/263416/677735
+ unchecked // Overflow is fine, just wrap
+ {
+ int hash = 41;
+ // Suitable nullity checks etc, of course :)
+
+ if (this.Id != null)
+ hash = hash * 57 + this.Id.GetHashCode();
+
+ if (this.PetId != null)
+ hash = hash * 57 + this.PetId.GetHashCode();
+
+ if (this.Quantity != null)
+ hash = hash * 57 + this.Quantity.GetHashCode();
+
+ if (this.ShipDate != null)
+ hash = hash * 57 + this.ShipDate.GetHashCode();
+
+ if (this.Status != null)
+ hash = hash * 57 + this.Status.GetHashCode();
+
+ if (this.Complete != null)
+ hash = hash * 57 + this.Complete.GetHashCode();
+
+ return hash;
+ }
+ }
+
}
-
- ///
- /// Get the JSON string presentation of the object
- ///
- /// JSON string presentation of the object
- public string ToJson() {
- return JsonConvert.SerializeObject(this, Formatting.Indented);
- }
-
-}
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs
index 37c80259944..d85d8a8be7e 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
@@ -6,89 +7,176 @@ using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
-namespace IO.Swagger.Model {
-
- ///
- ///
- ///
- [DataContract]
- public class Pet {
-
- ///
- /// Gets or Sets Id
- ///
- [DataMember(Name="id", EmitDefaultValue=false)]
- public long? Id { get; set; }
-
-
- ///
- /// Gets or Sets Category
- ///
- [DataMember(Name="category", EmitDefaultValue=false)]
- public Category Category { get; set; }
-
-
- ///
- /// Gets or Sets Name
- ///
- [DataMember(Name="name", EmitDefaultValue=false)]
- public string Name { get; set; }
-
-
- ///
- /// Gets or Sets PhotoUrls
- ///
- [DataMember(Name="photoUrls", EmitDefaultValue=false)]
- public List PhotoUrls { get; set; }
-
-
- ///
- /// Gets or Sets Tags
- ///
- [DataMember(Name="tags", EmitDefaultValue=false)]
- public List Tags { get; set; }
-
-
- ///
- /// pet status in the store
- ///
- /// pet status in the store
- [DataMember(Name="status", EmitDefaultValue=false)]
- public string Status { get; set; }
-
-
+namespace IO.Swagger.Model
+{
///
- /// Get the string presentation of the object
+ ///
///
- /// String presentation of the object
- public override string ToString() {
- var sb = new StringBuilder();
- sb.Append("class Pet {\n");
-
- sb.Append(" Id: ").Append(Id).Append("\n");
-
- sb.Append(" Category: ").Append(Category).Append("\n");
-
- sb.Append(" Name: ").Append(Name).Append("\n");
-
- sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
-
- sb.Append(" Tags: ").Append(Tags).Append("\n");
-
- sb.Append(" Status: ").Append(Status).Append("\n");
-
- sb.Append("}\n");
- return sb.ToString();
+ [DataContract]
+ public class Pet : IEquatable
+ {
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [DataMember(Name="id", EmitDefaultValue=false)]
+ public long? Id { get; set; }
+
+
+ ///
+ /// Gets or Sets Category
+ ///
+ [DataMember(Name="category", EmitDefaultValue=false)]
+ public Category Category { get; set; }
+
+
+ ///
+ /// Gets or Sets Name
+ ///
+ [DataMember(Name="name", EmitDefaultValue=false)]
+ public string Name { get; set; }
+
+
+ ///
+ /// Gets or Sets PhotoUrls
+ ///
+ [DataMember(Name="photoUrls", EmitDefaultValue=false)]
+ public List PhotoUrls { get; set; }
+
+
+ ///
+ /// Gets or Sets Tags
+ ///
+ [DataMember(Name="tags", EmitDefaultValue=false)]
+ public List Tags { get; set; }
+
+
+ ///
+ /// pet status in the store
+ ///
+ /// pet status in the store
+ [DataMember(Name="status", EmitDefaultValue=false)]
+ public string Status { get; set; }
+
+
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class Pet {\n");
+ sb.Append(" Id: ").Append(Id).Append("\n");
+ sb.Append(" Category: ").Append(Category).Append("\n");
+ sb.Append(" Name: ").Append(Name).Append("\n");
+ sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
+ sb.Append(" Tags: ").Append(Tags).Append("\n");
+ sb.Append(" Status: ").Append(Status).Append("\n");
+
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object obj)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ return this.Equals(obj as Pet);
+ }
+
+ ///
+ /// Returns true if Pet instances are equal
+ ///
+ /// Instance of Pet to be compared
+ /// Boolean
+ public bool Equals(Pet other)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ if (other == null)
+ return false;
+
+ return
+ (
+ this.Id == other.Id ||
+ this.Id != null &&
+ this.Id.Equals(other.Id)
+ ) &&
+ (
+ this.Category == other.Category ||
+ this.Category != null &&
+ this.Category.Equals(other.Category)
+ ) &&
+ (
+ this.Name == other.Name ||
+ this.Name != null &&
+ this.Name.Equals(other.Name)
+ ) &&
+ (
+ this.PhotoUrls == other.PhotoUrls ||
+ this.PhotoUrls != null &&
+ this.PhotoUrls.SequenceEqual(other.PhotoUrls)
+ ) &&
+ (
+ this.Tags == other.Tags ||
+ this.Tags != null &&
+ this.Tags.SequenceEqual(other.Tags)
+ ) &&
+ (
+ this.Status == other.Status ||
+ this.Status != null &&
+ this.Status.Equals(other.Status)
+ );
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ // credit: http://stackoverflow.com/a/263416/677735
+ unchecked // Overflow is fine, just wrap
+ {
+ int hash = 41;
+ // Suitable nullity checks etc, of course :)
+
+ if (this.Id != null)
+ hash = hash * 57 + this.Id.GetHashCode();
+
+ if (this.Category != null)
+ hash = hash * 57 + this.Category.GetHashCode();
+
+ if (this.Name != null)
+ hash = hash * 57 + this.Name.GetHashCode();
+
+ if (this.PhotoUrls != null)
+ hash = hash * 57 + this.PhotoUrls.GetHashCode();
+
+ if (this.Tags != null)
+ hash = hash * 57 + this.Tags.GetHashCode();
+
+ if (this.Status != null)
+ hash = hash * 57 + this.Status.GetHashCode();
+
+ return hash;
+ }
+ }
+
}
-
- ///
- /// Get the JSON string presentation of the object
- ///
- /// JSON string presentation of the object
- public string ToJson() {
- return JsonConvert.SerializeObject(this, Formatting.Indented);
- }
-
-}
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs
index 7d2ea38833b..8b2cbe08474 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
@@ -6,52 +7,111 @@ using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
-namespace IO.Swagger.Model {
-
- ///
- ///
- ///
- [DataContract]
- public class Tag {
-
- ///
- /// Gets or Sets Id
- ///
- [DataMember(Name="id", EmitDefaultValue=false)]
- public long? Id { get; set; }
-
-
- ///
- /// Gets or Sets Name
- ///
- [DataMember(Name="name", EmitDefaultValue=false)]
- public string Name { get; set; }
-
-
+namespace IO.Swagger.Model
+{
///
- /// Get the string presentation of the object
+ ///
///
- /// String presentation of the object
- public override string ToString() {
- var sb = new StringBuilder();
- sb.Append("class Tag {\n");
-
- sb.Append(" Id: ").Append(Id).Append("\n");
-
- sb.Append(" Name: ").Append(Name).Append("\n");
-
- sb.Append("}\n");
- return sb.ToString();
+ [DataContract]
+ public class Tag : IEquatable
+ {
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [DataMember(Name="id", EmitDefaultValue=false)]
+ public long? Id { get; set; }
+
+
+ ///
+ /// Gets or Sets Name
+ ///
+ [DataMember(Name="name", EmitDefaultValue=false)]
+ public string Name { get; set; }
+
+
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class Tag {\n");
+ sb.Append(" Id: ").Append(Id).Append("\n");
+ sb.Append(" Name: ").Append(Name).Append("\n");
+
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object obj)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ return this.Equals(obj as Tag);
+ }
+
+ ///
+ /// Returns true if Tag instances are equal
+ ///
+ /// Instance of Tag to be compared
+ /// Boolean
+ public bool Equals(Tag other)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ if (other == null)
+ return false;
+
+ return
+ (
+ this.Id == other.Id ||
+ this.Id != null &&
+ this.Id.Equals(other.Id)
+ ) &&
+ (
+ this.Name == other.Name ||
+ this.Name != null &&
+ this.Name.Equals(other.Name)
+ );
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ // credit: http://stackoverflow.com/a/263416/677735
+ unchecked // Overflow is fine, just wrap
+ {
+ int hash = 41;
+ // Suitable nullity checks etc, of course :)
+
+ if (this.Id != null)
+ hash = hash * 57 + this.Id.GetHashCode();
+
+ if (this.Name != null)
+ hash = hash * 57 + this.Name.GetHashCode();
+
+ return hash;
+ }
+ }
+
}
-
- ///
- /// Get the JSON string presentation of the object
- ///
- /// JSON string presentation of the object
- public string ToJson() {
- return JsonConvert.SerializeObject(this, Formatting.Indented);
- }
-
-}
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs
index 5430d1182cb..d2c1e3a46eb 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
@@ -6,107 +7,208 @@ using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
-namespace IO.Swagger.Model {
-
- ///
- ///
- ///
- [DataContract]
- public class User {
-
- ///
- /// Gets or Sets Id
- ///
- [DataMember(Name="id", EmitDefaultValue=false)]
- public long? Id { get; set; }
-
-
- ///
- /// Gets or Sets Username
- ///
- [DataMember(Name="username", EmitDefaultValue=false)]
- public string Username { get; set; }
-
-
- ///
- /// Gets or Sets FirstName
- ///
- [DataMember(Name="firstName", EmitDefaultValue=false)]
- public string FirstName { get; set; }
-
-
- ///
- /// Gets or Sets LastName
- ///
- [DataMember(Name="lastName", EmitDefaultValue=false)]
- public string LastName { get; set; }
-
-
- ///
- /// Gets or Sets Email
- ///
- [DataMember(Name="email", EmitDefaultValue=false)]
- public string Email { get; set; }
-
-
- ///
- /// Gets or Sets Password
- ///
- [DataMember(Name="password", EmitDefaultValue=false)]
- public string Password { get; set; }
-
-
- ///
- /// Gets or Sets Phone
- ///
- [DataMember(Name="phone", EmitDefaultValue=false)]
- public string Phone { get; set; }
-
-
- ///
- /// User Status
- ///
- /// User Status
- [DataMember(Name="userStatus", EmitDefaultValue=false)]
- public int? UserStatus { get; set; }
-
-
+namespace IO.Swagger.Model
+{
///
- /// Get the string presentation of the object
+ ///
///
- /// String presentation of the object
- public override string ToString() {
- var sb = new StringBuilder();
- sb.Append("class User {\n");
-
- sb.Append(" Id: ").Append(Id).Append("\n");
-
- sb.Append(" Username: ").Append(Username).Append("\n");
-
- sb.Append(" FirstName: ").Append(FirstName).Append("\n");
-
- sb.Append(" LastName: ").Append(LastName).Append("\n");
-
- sb.Append(" Email: ").Append(Email).Append("\n");
-
- sb.Append(" Password: ").Append(Password).Append("\n");
-
- sb.Append(" Phone: ").Append(Phone).Append("\n");
-
- sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
-
- sb.Append("}\n");
- return sb.ToString();
+ [DataContract]
+ public class User : IEquatable
+ {
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [DataMember(Name="id", EmitDefaultValue=false)]
+ public long? Id { get; set; }
+
+
+ ///
+ /// Gets or Sets Username
+ ///
+ [DataMember(Name="username", EmitDefaultValue=false)]
+ public string Username { get; set; }
+
+
+ ///
+ /// Gets or Sets FirstName
+ ///
+ [DataMember(Name="firstName", EmitDefaultValue=false)]
+ public string FirstName { get; set; }
+
+
+ ///
+ /// Gets or Sets LastName
+ ///
+ [DataMember(Name="lastName", EmitDefaultValue=false)]
+ public string LastName { get; set; }
+
+
+ ///
+ /// Gets or Sets Email
+ ///
+ [DataMember(Name="email", EmitDefaultValue=false)]
+ public string Email { get; set; }
+
+
+ ///
+ /// Gets or Sets Password
+ ///
+ [DataMember(Name="password", EmitDefaultValue=false)]
+ public string Password { get; set; }
+
+
+ ///
+ /// Gets or Sets Phone
+ ///
+ [DataMember(Name="phone", EmitDefaultValue=false)]
+ public string Phone { get; set; }
+
+
+ ///
+ /// User Status
+ ///
+ /// User Status
+ [DataMember(Name="userStatus", EmitDefaultValue=false)]
+ public int? UserStatus { get; set; }
+
+
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class User {\n");
+ sb.Append(" Id: ").Append(Id).Append("\n");
+ sb.Append(" Username: ").Append(Username).Append("\n");
+ sb.Append(" FirstName: ").Append(FirstName).Append("\n");
+ sb.Append(" LastName: ").Append(LastName).Append("\n");
+ sb.Append(" Email: ").Append(Email).Append("\n");
+ sb.Append(" Password: ").Append(Password).Append("\n");
+ sb.Append(" Phone: ").Append(Phone).Append("\n");
+ sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
+
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object obj)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ return this.Equals(obj as User);
+ }
+
+ ///
+ /// Returns true if User instances are equal
+ ///
+ /// Instance of User to be compared
+ /// Boolean
+ public bool Equals(User other)
+ {
+ // credit: http://stackoverflow.com/a/10454552/677735
+ if (other == null)
+ return false;
+
+ return
+ (
+ this.Id == other.Id ||
+ this.Id != null &&
+ this.Id.Equals(other.Id)
+ ) &&
+ (
+ this.Username == other.Username ||
+ this.Username != null &&
+ this.Username.Equals(other.Username)
+ ) &&
+ (
+ this.FirstName == other.FirstName ||
+ this.FirstName != null &&
+ this.FirstName.Equals(other.FirstName)
+ ) &&
+ (
+ this.LastName == other.LastName ||
+ this.LastName != null &&
+ this.LastName.Equals(other.LastName)
+ ) &&
+ (
+ this.Email == other.Email ||
+ this.Email != null &&
+ this.Email.Equals(other.Email)
+ ) &&
+ (
+ this.Password == other.Password ||
+ this.Password != null &&
+ this.Password.Equals(other.Password)
+ ) &&
+ (
+ this.Phone == other.Phone ||
+ this.Phone != null &&
+ this.Phone.Equals(other.Phone)
+ ) &&
+ (
+ this.UserStatus == other.UserStatus ||
+ this.UserStatus != null &&
+ this.UserStatus.Equals(other.UserStatus)
+ );
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ // credit: http://stackoverflow.com/a/263416/677735
+ unchecked // Overflow is fine, just wrap
+ {
+ int hash = 41;
+ // Suitable nullity checks etc, of course :)
+
+ if (this.Id != null)
+ hash = hash * 57 + this.Id.GetHashCode();
+
+ if (this.Username != null)
+ hash = hash * 57 + this.Username.GetHashCode();
+
+ if (this.FirstName != null)
+ hash = hash * 57 + this.FirstName.GetHashCode();
+
+ if (this.LastName != null)
+ hash = hash * 57 + this.LastName.GetHashCode();
+
+ if (this.Email != null)
+ hash = hash * 57 + this.Email.GetHashCode();
+
+ if (this.Password != null)
+ hash = hash * 57 + this.Password.GetHashCode();
+
+ if (this.Phone != null)
+ hash = hash * 57 + this.Phone.GetHashCode();
+
+ if (this.UserStatus != null)
+ hash = hash * 57 + this.UserStatus.GetHashCode();
+
+ return hash;
+ }
+ }
+
}
-
- ///
- /// Get the JSON string presentation of the object
- ///
- /// JSON string presentation of the object
- public string ToJson() {
- return JsonConvert.SerializeObject(this, Formatting.Indented);
- }
-
-}
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs
index 31e5cba141b..05585bff932 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs
@@ -2,8 +2,25 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs
index 5a42b8703c2..0227a2d9113 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs
@@ -1,5 +1,6 @@
using NUnit.Framework;
using System;
+using System.Linq;
using System.IO;
using System.Collections.Generic;
using IO.Swagger.Api;
@@ -144,6 +145,68 @@ namespace SwaggerClient.TestPet
}
+ [Test ()]
+ public void TestEqual()
+ {
+ // create pet
+ Pet p1 = new Pet();
+ p1.Id = petId;
+ p1.Name = "Csharp test";
+ p1.Status = "available";
+ // create Category object
+ Category category1 = new Category();
+ category1.Id = 56;
+ category1.Name = "sample category name2";
+ List photoUrls1 = new List(new String[] {"sample photoUrls"});
+ // create Tag object
+ Tag tag1 = new Tag();
+ tag1.Id = petId;
+ tag1.Name = "sample tag name1";
+ List tags1 = new List(new Tag[] {tag1});
+ p1.Tags = tags1;
+ p1.Category = category1;
+ p1.PhotoUrls = photoUrls1;
+
+ // create pet 2
+ Pet p2 = new Pet();
+ p2.Id = petId;
+ p2.Name = "Csharp test";
+ p2.Status = "available";
+ // create Category object
+ Category category2 = new Category();
+ category2.Id = 56;
+ category2.Name = "sample category name2";
+ List photoUrls2 = new List(new String[] {"sample photoUrls"});
+ // create Tag object
+ Tag tag2 = new Tag();
+ tag2.Id = petId;
+ tag2.Name = "sample tag name1";
+ List tags2 = new List(new Tag[] {tag2});
+ p2.Tags = tags2;
+ p2.Category = category2;
+ p2.PhotoUrls = photoUrls2;
+
+ // p1 and p2 should be equal (both object and attribute level)
+ Assert.IsTrue (category1.Equals (category2));
+ Assert.IsTrue (tags1.SequenceEqual (tags2));
+ Assert.IsTrue (p1.PhotoUrls.SequenceEqual(p2.PhotoUrls));
+
+ Assert.IsTrue (p1.Equals (p2));
+
+ // update attribute to that p1 and p2 are not equal
+ category2.Name = "new category name";
+ Assert.IsFalse(category1.Equals (category2));
+
+ tags2 = new List ();
+ Assert.IsFalse (tags1.SequenceEqual (tags2));
+
+ // photoUrls has not changed so it should be equal
+ Assert.IsTrue (p1.PhotoUrls.SequenceEqual(p2.PhotoUrls));
+
+ Assert.IsFalse (p1.Equals (p2));
+
+ }
+
}
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
index c975e54d4be..924934c4623 100755
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll and b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll differ
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb
index 5c1092d07fc..d0d7f1b3ccf 100644
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb and b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb differ
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt
index 3ed0e98c4f7..b46eed9f9d6 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt
+++ b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt
@@ -1,8 +1,8 @@
-/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs
-/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb
-/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
-/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll
-/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
-/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll
-/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll
-/Users/williamcheng/Code/csharp/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll
+/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs
+/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb
+/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
+/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll
+/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
+/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll
+/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll
+/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll
index c975e54d4be..924934c4623 100755
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll and b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll differ
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
index 5c1092d07fc..d0d7f1b3ccf 100644
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb and b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb differ