Update samples for C#/SwaggerClientWithPropertyChanged. (#5095)

This commit is contained in:
Paŭlo Ebermann 2017-03-18 10:08:17 +01:00 committed by wing328
parent 426660206d
commit 4706f4da3e
7 changed files with 396 additions and 7 deletions

View File

@ -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

View File

@ -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)

View File

@ -74,7 +74,7 @@ Contact: apiteam@swagger.io
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\IO.Swagger\IO.Swagger.csproj">
<Project>{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}</Project>
<Project>{6D420517-C79A-4919-BDE7-8CEEAC1BC6B4}</Project>
<Name>IO.Swagger</Name>
</ProjectReference>
</ItemGroup>

View File

@ -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
{
/// <summary>
/// Class for testing Capitalization
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class CapitalizationTests
{
// TODO uncomment below to declare an instance variable for Capitalization
//private Capitalization instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of Capitalization
//instance = new Capitalization();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of Capitalization
/// </summary>
[Test]
public void CapitalizationInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" Capitalization
//Assert.IsInstanceOfType<Capitalization> (instance, "variable 'instance' is a Capitalization");
}
/// <summary>
/// Test the property 'SmallCamel'
/// </summary>
[Test]
public void SmallCamelTest()
{
// TODO unit test for the property 'SmallCamel'
}
/// <summary>
/// Test the property 'CapitalCamel'
/// </summary>
[Test]
public void CapitalCamelTest()
{
// TODO unit test for the property 'CapitalCamel'
}
/// <summary>
/// Test the property 'SmallSnake'
/// </summary>
[Test]
public void SmallSnakeTest()
{
// TODO unit test for the property 'SmallSnake'
}
/// <summary>
/// Test the property 'CapitalSnake'
/// </summary>
[Test]
public void CapitalSnakeTest()
{
// TODO unit test for the property 'CapitalSnake'
}
/// <summary>
/// Test the property 'SCAETHFlowPoints'
/// </summary>
[Test]
public void SCAETHFlowPointsTest()
{
// TODO unit test for the property 'SCAETHFlowPoints'
}
/// <summary>
/// Test the property 'ATT_NAME'
/// </summary>
[Test]
public void ATT_NAMETest()
{
// TODO unit test for the property 'ATT_NAME'
}
}
}

View File

@ -11,7 +11,7 @@ Contact: apiteam@swagger.io
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DA3C5AEB-7E43-42AF-838D-141FF1DDB66B}</ProjectGuid>
<ProjectGuid>{6D420517-C79A-4919-BDE7-8CEEAC1BC6B4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IO.Swagger</RootNamespace>

View File

@ -0,0 +1,44 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- The identifier that must be unique within the hosting gallery -->
<id>$id$</id>
<title>Swagger Library</title>
<!-- The package version number that is used when resolving dependencies -->
<version>$version$</version>
<!-- Authors contain text that appears directly on the gallery -->
<authors>$author$</authors>
<!-- Owners are typically nuget.org identities that allow gallery
users to earily find other packages by the same owners. -->
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<developmentDependency>false</developmentDependency>
<!-- The description can be used in package manager UI. Note that the
nuget.org gallery uses information you add in the portal. -->
<description>A library generated from a Swagger doc</description>
<copyright>http://swagger.io/terms/</copyright>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>
<dependency id="NewtonSoft.Json" version="8.0.3" />
<dependency id="RestSharp" version="105.1.0" />
<dependency id="Fody" version="1.29.2" />
<dependency id="PropertyChanged.Fody" version="1.51.3" />
</dependencies>
</metadata>
<files>
<!-- A readme.txt will be displayed when the package is installed -->
<file src="..\..\README.md" target="" />
<file src="..\..\docs\**\*.*" target="docs" />
<file src="..\..\packages\Fody.1.29.2\build\portable-net+sl+win+wpa+wp\Fody.targets" target="build" />
</files>
</package>

View File

@ -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
{
/// <summary>
/// Capitalization
/// </summary>
[DataContract]
[ImplementPropertyChanged]
public partial class Capitalization : IEquatable<Capitalization>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Capitalization" /> class.
/// </summary>
/// <param name="SmallCamel">SmallCamel.</param>
/// <param name="CapitalCamel">CapitalCamel.</param>
/// <param name="SmallSnake">SmallSnake.</param>
/// <param name="CapitalSnake">CapitalSnake.</param>
/// <param name="SCAETHFlowPoints">SCAETHFlowPoints.</param>
/// <param name="ATT_NAME">Name of the pet .</param>
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;
}
/// <summary>
/// Gets or Sets SmallCamel
/// </summary>
[DataMember(Name="smallCamel", EmitDefaultValue=false)]
public string SmallCamel { get; set; }
/// <summary>
/// Gets or Sets CapitalCamel
/// </summary>
[DataMember(Name="CapitalCamel", EmitDefaultValue=false)]
public string CapitalCamel { get; set; }
/// <summary>
/// Gets or Sets SmallSnake
/// </summary>
[DataMember(Name="small_Snake", EmitDefaultValue=false)]
public string SmallSnake { get; set; }
/// <summary>
/// Gets or Sets CapitalSnake
/// </summary>
[DataMember(Name="Capital_Snake", EmitDefaultValue=false)]
public string CapitalSnake { get; set; }
/// <summary>
/// Gets or Sets SCAETHFlowPoints
/// </summary>
[DataMember(Name="SCA_ETH_Flow_Points", EmitDefaultValue=false)]
public string SCAETHFlowPoints { get; set; }
/// <summary>
/// Name of the pet
/// </summary>
/// <value>Name of the pet </value>
[DataMember(Name="ATT_NAME", EmitDefaultValue=false)]
public string ATT_NAME { 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 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();
}
/// <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="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as Capitalization);
}
/// <summary>
/// Returns true if Capitalization instances are equal
/// </summary>
/// <param name="other">Instance of Capitalization to be compared</param>
/// <returns>Boolean</returns>
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)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
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<ValidationResult> Validate(ValidationContext validationContext)
{
yield break;
}
}
}