From 4706f4da3e5dab4ea1a7c10ab7448fd45cee743f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Sat, 18 Mar 2017 10:08:17 +0100 Subject: [PATCH] Update samples for C#/SwaggerClientWithPropertyChanged. (#5095) --- .../IO.Swagger.sln | 10 +- .../docs/Capitalization.md | 14 ++ .../IO.Swagger.Test/IO.Swagger.Test.csproj | 2 +- .../Model/CapitalizationTests.cs | 118 ++++++++++ .../src/IO.Swagger/IO.Swagger.csproj | 2 +- .../src/IO.Swagger/IO.Swagger.nuspec | 44 ++++ .../src/IO.Swagger/Model/Capitalization.cs | 213 ++++++++++++++++++ 7 files changed, 396 insertions(+), 7 deletions(-) create mode 100644 samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Capitalization.md create mode 100644 samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs create mode 100644 samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.nuspec create mode 100644 samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln index 6faeeb36d23..dd827591172 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{6D420517-C79A-4919-BDE7-8CEEAC1BC6B4}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}.Debug|Any CPU.Build.0 = Debug|Any CPU -{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}.Release|Any CPU.ActiveCfg = Release|Any CPU -{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}.Release|Any CPU.Build.0 = Release|Any CPU +{6D420517-C79A-4919-BDE7-8CEEAC1BC6B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{6D420517-C79A-4919-BDE7-8CEEAC1BC6B4}.Debug|Any CPU.Build.0 = Debug|Any CPU +{6D420517-C79A-4919-BDE7-8CEEAC1BC6B4}.Release|Any CPU.ActiveCfg = Release|Any CPU +{6D420517-C79A-4919-BDE7-8CEEAC1BC6B4}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Capitalization.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Capitalization.md new file mode 100644 index 00000000000..87d14f03e0d --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Capitalization.md @@ -0,0 +1,14 @@ +# IO.Swagger.Model.Capitalization +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SmallCamel** | **string** | | [optional] +**CapitalCamel** | **string** | | [optional] +**SmallSnake** | **string** | | [optional] +**CapitalSnake** | **string** | | [optional] +**SCAETHFlowPoints** | **string** | | [optional] +**ATT_NAME** | **string** | Name of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 0706f26970f..ca7e86553d9 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -74,7 +74,7 @@ Contact: apiteam@swagger.io - {DA3C5AEB-7E43-42AF-838D-141FF1DDB66B} + {6D420517-C79A-4919-BDE7-8CEEAC1BC6B4} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs new file mode 100644 index 00000000000..30ed8700f74 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs @@ -0,0 +1,118 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing Capitalization + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class CapitalizationTests + { + // TODO uncomment below to declare an instance variable for Capitalization + //private Capitalization instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of Capitalization + //instance = new Capitalization(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of Capitalization + /// + [Test] + public void CapitalizationInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Capitalization + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Capitalization"); + } + + /// + /// Test the property 'SmallCamel' + /// + [Test] + public void SmallCamelTest() + { + // TODO unit test for the property 'SmallCamel' + } + /// + /// Test the property 'CapitalCamel' + /// + [Test] + public void CapitalCamelTest() + { + // TODO unit test for the property 'CapitalCamel' + } + /// + /// Test the property 'SmallSnake' + /// + [Test] + public void SmallSnakeTest() + { + // TODO unit test for the property 'SmallSnake' + } + /// + /// Test the property 'CapitalSnake' + /// + [Test] + public void CapitalSnakeTest() + { + // TODO unit test for the property 'CapitalSnake' + } + /// + /// Test the property 'SCAETHFlowPoints' + /// + [Test] + public void SCAETHFlowPointsTest() + { + // TODO unit test for the property 'SCAETHFlowPoints' + } + /// + /// Test the property 'ATT_NAME' + /// + [Test] + public void ATT_NAMETest() + { + // TODO unit test for the property 'ATT_NAME' + } + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj index 646b0653945..748f3f5106b 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj @@ -11,7 +11,7 @@ Contact: apiteam@swagger.io Debug AnyCPU - {DA3C5AEB-7E43-42AF-838D-141FF1DDB66B} + {6D420517-C79A-4919-BDE7-8CEEAC1BC6B4} Library Properties IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.nuspec b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.nuspec new file mode 100644 index 00000000000..87ba93febfe --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.nuspec @@ -0,0 +1,44 @@ + + + + + $id$ + Swagger Library + + + $version$ + + + $author$ + + + $author$ + false + false + + + A library generated from a Swagger doc + http://swagger.io/terms/ + http://www.apache.org/licenses/LICENSE-2.0.html + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs new file mode 100644 index 00000000000..2f11e06c42f --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs @@ -0,0 +1,213 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * 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 PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace IO.Swagger.Model +{ + /// + /// Capitalization + /// + [DataContract] + [ImplementPropertyChanged] + public partial class Capitalization : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// SmallCamel. + /// CapitalCamel. + /// SmallSnake. + /// CapitalSnake. + /// SCAETHFlowPoints. + /// Name of the pet . + public Capitalization(string SmallCamel = default(string), string CapitalCamel = default(string), string SmallSnake = default(string), string CapitalSnake = default(string), string SCAETHFlowPoints = default(string), string ATT_NAME = default(string)) + { + this.SmallCamel = SmallCamel; + this.CapitalCamel = CapitalCamel; + this.SmallSnake = SmallSnake; + this.CapitalSnake = CapitalSnake; + this.SCAETHFlowPoints = SCAETHFlowPoints; + this.ATT_NAME = ATT_NAME; + } + + /// + /// Gets or Sets SmallCamel + /// + [DataMember(Name="smallCamel", EmitDefaultValue=false)] + public string SmallCamel { get; set; } + /// + /// Gets or Sets CapitalCamel + /// + [DataMember(Name="CapitalCamel", EmitDefaultValue=false)] + public string CapitalCamel { get; set; } + /// + /// Gets or Sets SmallSnake + /// + [DataMember(Name="small_Snake", EmitDefaultValue=false)] + public string SmallSnake { get; set; } + /// + /// Gets or Sets CapitalSnake + /// + [DataMember(Name="Capital_Snake", EmitDefaultValue=false)] + public string CapitalSnake { get; set; } + /// + /// Gets or Sets SCAETHFlowPoints + /// + [DataMember(Name="SCA_ETH_Flow_Points", EmitDefaultValue=false)] + public string SCAETHFlowPoints { get; set; } + /// + /// Name of the pet + /// + /// Name of the pet + [DataMember(Name="ATT_NAME", EmitDefaultValue=false)] + public string ATT_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 Capitalization {\n"); + sb.Append(" SmallCamel: ").Append(SmallCamel).Append("\n"); + sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append("\n"); + sb.Append(" SmallSnake: ").Append(SmallSnake).Append("\n"); + sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append("\n"); + sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append("\n"); + sb.Append(" ATT_NAME: ").Append(ATT_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 Capitalization); + } + + /// + /// Returns true if Capitalization instances are equal + /// + /// Instance of Capitalization to be compared + /// Boolean + public bool Equals(Capitalization other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.SmallCamel == other.SmallCamel || + this.SmallCamel != null && + this.SmallCamel.Equals(other.SmallCamel) + ) && + ( + this.CapitalCamel == other.CapitalCamel || + this.CapitalCamel != null && + this.CapitalCamel.Equals(other.CapitalCamel) + ) && + ( + this.SmallSnake == other.SmallSnake || + this.SmallSnake != null && + this.SmallSnake.Equals(other.SmallSnake) + ) && + ( + this.CapitalSnake == other.CapitalSnake || + this.CapitalSnake != null && + this.CapitalSnake.Equals(other.CapitalSnake) + ) && + ( + this.SCAETHFlowPoints == other.SCAETHFlowPoints || + this.SCAETHFlowPoints != null && + this.SCAETHFlowPoints.Equals(other.SCAETHFlowPoints) + ) && + ( + this.ATT_NAME == other.ATT_NAME || + this.ATT_NAME != null && + this.ATT_NAME.Equals(other.ATT_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.SmallCamel != null) + hash = hash * 59 + this.SmallCamel.GetHashCode(); + if (this.CapitalCamel != null) + hash = hash * 59 + this.CapitalCamel.GetHashCode(); + if (this.SmallSnake != null) + hash = hash * 59 + this.SmallSnake.GetHashCode(); + if (this.CapitalSnake != null) + hash = hash * 59 + this.CapitalSnake.GetHashCode(); + if (this.SCAETHFlowPoints != null) + hash = hash * 59 + this.SCAETHFlowPoints.GetHashCode(); + if (this.ATT_NAME != null) + hash = hash * 59 + this.ATT_NAME.GetHashCode(); + return hash; + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +}