Merge pull request #3115 from wing328/csharp_add_mono_test

[C#] Add mono test script, various enhancements
This commit is contained in:
wing328 2016-06-12 13:21:54 +08:00 committed by GitHub
commit dda6c600ae
48 changed files with 310 additions and 113 deletions

1
.gitignore vendored
View File

@ -112,6 +112,7 @@ samples/client/petstore/csharp/SwaggerClient/bin
samples/client/petstore/csharp/SwaggerClient/obj/Debug/ samples/client/petstore/csharp/SwaggerClient/obj/Debug/
samples/client/petstore/csharp/SwaggerClient/bin/Debug/ samples/client/petstore/csharp/SwaggerClient/bin/Debug/
samples/client/petstore/csharp/SwaggerClient/packages samples/client/petstore/csharp/SwaggerClient/packages
samples/client/petstore/csharp/SwaggerClient/TestResult.xml
# Python # Python
*.pyc *.pyc

View File

@ -238,6 +238,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat")); supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat"));
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "build.sh")); supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "build.sh"));
// shell script to run the nunit test
supportingFiles.add(new SupportingFile("mono_nunit_test.mustache", "", "mono_nunit_test.sh"));
// copy package.config to nuget's standard location for project-level installs // copy package.config to nuget's standard location for project-level installs
supportingFiles.add(new SupportingFile("packages.config.mustache", packageFolder + File.separator, "packages.config")); supportingFiles.add(new SupportingFile("packages.config.mustache", packageFolder + File.separator, "packages.config"));

View File

@ -1,7 +1,15 @@
{{>partial_header}}
using System; using System;
using RestSharp; using RestSharp;
namespace {{packageName}}.Client namespace {{packageName}}.Client
{ {
/// <summary>
/// A delegate to ExceptionFactory method
/// </summary>
/// <param name="methodName">Method name</param>
/// <param name="response">Response</param>
/// <returns>Exceptions</returns>
public delegate Exception ExceptionFactory(string methodName, IRestResponse response); public delegate Exception ExceptionFactory(string methodName, IRestResponse response);
} }

View File

@ -71,10 +71,10 @@ limitations under the License.
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="RestSharp"> <Reference Include="RestSharp">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>

View File

@ -71,10 +71,10 @@ limitations under the License.
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="RestSharp"> <Reference Include="RestSharp">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>
@ -83,10 +83,10 @@ limitations under the License.
<HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath> <HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.3.2.1\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('..\packages')">..\packages\NUnit.3.2.1\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.3.2.1\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\NUnit.3.2.1\lib\nunit.framework.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -51,7 +51,8 @@ namespace {{packageName}}.Test
[Test] [Test]
public void {{operationId}}InstanceTest() public void {{operationId}}InstanceTest()
{ {
Assert.IsInstanceOf<{{classname}}> (instance, "instance is a {{classname}}"); // test 'IsInstanceOfType' {{classname}}
Assert.IsInstanceOfType(typeof({{classname}}), instance, "instance is a {{classname}}");
} }
{{#operations}}{{#operation}} {{#operations}}{{#operation}}
@ -61,12 +62,12 @@ namespace {{packageName}}.Test
[Test] [Test]
public void {{operationId}}Test() public void {{operationId}}Test()
{ {
// TODO: add unit test for the method '{{operationId}}' // TODO uncomment below to test the method and replace null with proper value
{{#allParams}} {{#allParams}}
{{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value //{{{dataType}}} {{paramName}} = null;
{{/allParams}} {{/allParams}}
{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); //{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{#returnType}}Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}} {{#returnType}}//Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}}
} }
{{/operation}}{{/operations}} {{/operation}}{{/operations}}
} }

View File

@ -1,15 +1,35 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
frameworkVersion={{targetFrameworkNuget}} frameworkVersion={{targetFrameworkNuget}}
netfx=${frameworkVersion#net} netfx=${frameworkVersion#net}
echo "[INFO] Target framework: ${frameworkVersion}"
echo "[INFO] Download nuget and packages"
wget -nc https://nuget.org/nuget.exe; wget -nc https://nuget.org/nuget.exe;
mozroots --import --sync mozroots --import --sync
mono nuget.exe install src/{{packageName}}/packages.config -o packages; mono nuget.exe install src/{{packageName}}/packages.config -o packages;
mkdir -p bin;
cp packages/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; echo "[INFO] Copy DLLs to the 'bin' folder"
mkdir -p bin;
cp packages/Newtonsoft.Json.8.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll; cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll;
echo "[INFO] Run 'mcs' to build bin/{{{packageName}}}.dll"
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\ mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
bin/RestSharp.dll,\ bin/RestSharp.dll,\
System.Runtime.Serialization.dll \ System.Runtime.Serialization.dll \
@ -18,3 +38,11 @@ System.Runtime.Serialization.dll \
-recurse:'src/{{packageName}}/*.cs' \ -recurse:'src/{{packageName}}/*.cs' \
-doc:bin/{{packageName}}.xml \ -doc:bin/{{packageName}}.xml \
-platform:anycpu -platform:anycpu
if [ $? -ne 0 ]
then
echo "[ERROR] Compilation failed with exit code $?"
exit 1
else
echo "[INFO] bin/{{{packageName}}}.dll was created successfully"
fi

View File

@ -1,3 +1,17 @@
:: Generated by: https://github.com/swagger-api/swagger-codegen.git
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
@echo off @echo off
{{#supportsAsync}}SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319{{/supportsAsync}} {{#supportsAsync}}SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319{{/supportsAsync}}
@ -8,7 +22,7 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient
if not exist ".\bin" mkdir bin if not exist ".\bin" mkdir bin
copy packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll copy packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll
copy packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll bin\RestSharp.dll copy packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll bin\RestSharp.dll
%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\{{packageName}}.dll /recurse:src\{{packageName}}\*.cs /doc:bin\{{packageName}}.xml %CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\{{packageName}}.dll /recurse:src\{{packageName}}\*.cs /doc:bin\{{packageName}}.xml

View File

@ -25,7 +25,8 @@ namespace {{packageName}}.Test
[TestFixture] [TestFixture]
public class {{classname}}Tests public class {{classname}}Tests
{ {
private {{classname}} instance; // TODO uncomment below to declare an instance variable for {{classname}}
//private {{classname}} instance;
/// <summary> /// <summary>
/// Setup before each test /// Setup before each test
@ -33,7 +34,8 @@ namespace {{packageName}}.Test
[SetUp] [SetUp]
public void Init() public void Init()
{ {
instance = new {{classname}}(); // TODO uncomment below to create an instance of {{classname}}
//instance = new {{classname}}();
} }
/// <summary> /// <summary>
@ -51,7 +53,8 @@ namespace {{packageName}}.Test
[Test] [Test]
public void {{classname}}InstanceTest() public void {{classname}}InstanceTest()
{ {
Assert.IsInstanceOf<{{classname}}> (instance, "instance is a {{classname}}"); // TODO uncomment below to test "IsInstanceOfType" {{classname}}
//Assert.IsInstanceOfType<{{classname}}> (instance, "variable 'instance' is a {{classname}}");
} }
{{#vars}} {{#vars}}
@ -61,7 +64,7 @@ namespace {{packageName}}.Test
[Test] [Test]
public void {{name}}Test() public void {{name}}Test()
{ {
// TODO: unit test for the property '{{name}}' // TODO unit test for the property '{{name}}'
} }
{{/vars}} {{/vars}}

View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
wget -nc https://nuget.org/nuget.exe
mozroots --import --sync
echo "[INFO] remove bin/Debug/SwaggerClientTest.dll"
rm src/IO.Swagger.Test/bin/Debug/{{{packageName}}}.Test.dll 2> /dev/null
echo "[INFO] install NUnit runners via NuGet"
wget -nc https://nuget.org/nuget.exe
mozroots --import --sync
mono nuget.exe install src/{{{packageName}}}.Test/packages.config -o packages
echo "[INFO] Install NUnit runners via NuGet"
mono nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory packages
echo "[INFO] Build the solution and run the unit test"
xbuild {{{packageName}}}.sln && \
mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe src/{{{packageName}}}.Test/bin/debug/{{{packageName}}}.Test.dll

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" /> <package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" /> <package id="Newtonsoft.Json" version="8.0.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
</packages> </packages>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="NUnit" version="2.6.3" targetFramework="{{targetFrameworkNuget}}" /> <package id="NUnit" version="3.2.1" targetFramework="{{targetFrameworkNuget}}" />
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" /> <package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" /> <package id="Newtonsoft.Json" version="8.0.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
</packages> </packages>

View File

@ -21,3 +21,4 @@
#docs/*.md #docs/*.md
# Then explicitly reverse the ignore rule for a single file: # Then explicitly reverse the ignore rule for a single file:
#!docs/README.md #!docs/README.md
src/IO.Swagger.Test/IO.Swagger.Test.csproj

View File

@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2012
VisualStudioVersion = 12.0.0.0 VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1 MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{EE727567-9CAF-4258-AA0E-FDF89487D7D6}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{7B20DAE3-B510-4814-8986-CF1B89EA039E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject EndProject
@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7B20DAE3-B510-4814-8986-CF1B89EA039E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {7B20DAE3-B510-4814-8986-CF1B89EA039E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {7B20DAE3-B510-4814-8986-CF1B89EA039E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Release|Any CPU.Build.0 = Release|Any CPU {7B20DAE3-B510-4814-8986-CF1B89EA039E}.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.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = 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 {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c
- API version: 1.0.0 - API version: 1.0.0
- SDK version: 1.0.0 - SDK version: 1.0.0
- Build date: 2016-06-10T08:07:39.769-04:00 - Build date: 2016-06-12T12:38:46.317+08:00
- Build package: class io.swagger.codegen.languages.CSharpClientCodegen - Build package: class io.swagger.codegen.languages.CSharpClientCodegen
## Frameworks supported ## Frameworks supported
@ -138,6 +138,12 @@ Class | Method | HTTP request | Description
## Documentation for Authorization ## Documentation for Authorization
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
### petstore_auth ### petstore_auth
- **Type**: OAuth - **Type**: OAuth
@ -147,9 +153,3 @@ Class | Method | HTTP request | Description
- write:pets: modify pets in your account - write:pets: modify pets in your account
- read:pets: read your pets - read:pets: read your pets
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header

View File

@ -1,3 +1,17 @@
:: Generated by: https://github.com/swagger-api/swagger-codegen.git
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
@echo off @echo off
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319 SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319
@ -8,7 +22,7 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient
if not exist ".\bin" mkdir bin if not exist ".\bin" mkdir bin
copy packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll copy packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll
copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll
%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml %CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml

View File

@ -1,15 +1,35 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
frameworkVersion=net45 frameworkVersion=net45
netfx=${frameworkVersion#net} netfx=${frameworkVersion#net}
echo "[INFO] Target framework: ${frameworkVersion}"
echo "[INFO] Download nuget and packages"
wget -nc https://nuget.org/nuget.exe; wget -nc https://nuget.org/nuget.exe;
mozroots --import --sync mozroots --import --sync
mono nuget.exe install src/IO.Swagger/packages.config -o packages; mono nuget.exe install src/IO.Swagger/packages.config -o packages;
mkdir -p bin;
cp packages/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; echo "[INFO] Copy DLLs to the 'bin' folder"
mkdir -p bin;
cp packages/Newtonsoft.Json.8.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll;
echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll"
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\ mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
bin/RestSharp.dll,\ bin/RestSharp.dll,\
System.Runtime.Serialization.dll \ System.Runtime.Serialization.dll \
@ -18,3 +38,11 @@ System.Runtime.Serialization.dll \
-recurse:'src/IO.Swagger/*.cs' \ -recurse:'src/IO.Swagger/*.cs' \
-doc:bin/IO.Swagger.xml \ -doc:bin/IO.Swagger.xml \
-platform:anycpu -platform:anycpu
if [ $? -ne 0 ]
then
echo "[ERROR] Compilation failed with exit code $?"
exit 1
else
echo "[INFO] bin/IO.Swagger.dll was created successfully"
fi

View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
wget -nc https://nuget.org/nuget.exe
mozroots --import --sync
echo "[INFO] remove bin/Debug/SwaggerClientTest.dll"
rm src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll 2> /dev/null
echo "[INFO] install NUnit runners via NuGet"
wget -nc https://nuget.org/nuget.exe
mozroots --import --sync
mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages
echo "[INFO] Install NUnit runners via NuGet"
mono nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory packages
echo "[INFO] Build the solution and run the unit test"
xbuild IO.Swagger.sln && \
mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe src/IO.Swagger.Test/bin/debug/IO.Swagger.Test.dll

View File

@ -48,7 +48,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void InstanceTest() public void InstanceTest()
{ {
Assert.IsInstanceOf<FakeApi> (instance, "instance is a FakeApi"); Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi");
} }

View File

@ -97,7 +97,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void InstanceTest() public void InstanceTest()
{ {
Assert.IsInstanceOf<PetApi> (instance, "instance is a PetApi"); Assert.IsInstanceOfType(typeof(PetApi), instance, "instance is a PetApi");
} }
@ -134,7 +134,7 @@ namespace IO.Swagger.Test
List<Pet> listPet = petApi.FindPetsByTags (tagsList); List<Pet> listPet = petApi.FindPetsByTags (tagsList);
foreach (Pet pet in listPet) // Loop through List with foreach. foreach (Pet pet in listPet) // Loop through List with foreach.
{ {
Assert.IsInstanceOf<Pet> (pet, "Response is a Pet"); Assert.IsInstanceOfType(typeof(Pet), pet, "Response is a Pet");
Assert.AreEqual ("csharp sample tag name1", pet.Tags[0]); Assert.AreEqual ("csharp sample tag name1", pet.Tags[0]);
} }
} }
@ -147,7 +147,7 @@ namespace IO.Swagger.Test
{ {
List<string> tags = new List<String>(new String[] {"pet"}); List<string> tags = new List<String>(new String[] {"pet"});
var response = instance.FindPetsByTags(tags); var response = instance.FindPetsByTags(tags);
Assert.IsInstanceOf<List<Pet>> (response, "response is List<Pet>"); Assert.IsInstanceOfType(typeof(List<Pet>), response, "response is List<Pet>");
} }
/// <summary> /// <summary>
@ -161,19 +161,19 @@ namespace IO.Swagger.Test
PetApi petApi = new PetApi (c1); PetApi petApi = new PetApi (c1);
Pet response = petApi.GetPetById (petId); Pet response = petApi.GetPetById (petId);
Assert.IsInstanceOf<Pet> (response, "Response is a Pet"); Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");
Assert.AreEqual ("Csharp test", response.Name); Assert.AreEqual ("Csharp test", response.Name);
Assert.AreEqual (Pet.StatusEnum.Available, response.Status); Assert.AreEqual (Pet.StatusEnum.Available, response.Status);
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array"); Assert.IsInstanceOfType(typeof(List<Tag>), response.Tags, "Response.Tags is a Array");
Assert.AreEqual (petId, response.Tags [0].Id); Assert.AreEqual (petId, response.Tags [0].Id);
Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);
Assert.IsInstanceOf<List<String>> (response.PhotoUrls, "Response.PhotoUrls is a Array"); Assert.IsInstanceOfType(typeof(List<String>), response.PhotoUrls, "Response.PhotoUrls is a Array");
Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);
Assert.IsInstanceOf<Category> (response.Category, "Response.Category is a Category"); Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
Assert.AreEqual (56, response.Category.Id); Assert.AreEqual (56, response.Category.Id);
Assert.AreEqual ("sample category name2", response.Category.Name); Assert.AreEqual ("sample category name2", response.Category.Name);
} }
@ -187,19 +187,19 @@ namespace IO.Swagger.Test
PetApi petApi = new PetApi (); PetApi petApi = new PetApi ();
var task = petApi.GetPetByIdAsync (petId); var task = petApi.GetPetByIdAsync (petId);
Pet response = task.Result; Pet response = task.Result;
Assert.IsInstanceOf<Pet> (response, "Response is a Pet"); Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");
Assert.AreEqual ("Csharp test", response.Name); Assert.AreEqual ("Csharp test", response.Name);
Assert.AreEqual (Pet.StatusEnum.Available, response.Status); Assert.AreEqual (Pet.StatusEnum.Available, response.Status);
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array"); Assert.IsInstanceOfType(typeof(List<Tag>), response.Tags, "Response.Tags is a Array");
Assert.AreEqual (petId, response.Tags [0].Id); Assert.AreEqual (petId, response.Tags [0].Id);
Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);
Assert.IsInstanceOf<List<String>> (response.PhotoUrls, "Response.PhotoUrls is a Array"); Assert.IsInstanceOfType(typeof(List<String>), response.PhotoUrls, "Response.PhotoUrls is a Array");
Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);
Assert.IsInstanceOf<Category> (response.Category, "Response.Category is a Category"); Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
Assert.AreEqual (56, response.Category.Id); Assert.AreEqual (56, response.Category.Id);
Assert.AreEqual ("sample category name2", response.Category.Name); Assert.AreEqual ("sample category name2", response.Category.Name);
@ -219,19 +219,19 @@ namespace IO.Swagger.Test
Assert.AreEqual (task.Result.Headers["Content-Type"], "application/json"); Assert.AreEqual (task.Result.Headers["Content-Type"], "application/json");
Pet response = task.Result.Data; Pet response = task.Result.Data;
Assert.IsInstanceOf<Pet> (response, "Response is a Pet"); Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");
Assert.AreEqual ("Csharp test", response.Name); Assert.AreEqual ("Csharp test", response.Name);
Assert.AreEqual (Pet.StatusEnum.Available, response.Status); Assert.AreEqual (Pet.StatusEnum.Available, response.Status);
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array"); Assert.IsInstanceOfType(typeof(List<Tag>), response.Tags, "Response.Tags is a Array");
Assert.AreEqual (petId, response.Tags [0].Id); Assert.AreEqual (petId, response.Tags [0].Id);
Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);
Assert.IsInstanceOf<List<String>> (response.PhotoUrls, "Response.PhotoUrls is a Array"); Assert.IsInstanceOfType(typeof(List<String>), response.PhotoUrls, "Response.PhotoUrls is a Array");
Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);
Assert.IsInstanceOf<Category> (response.Category, "Response.Category is a Category"); Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
Assert.AreEqual (56, response.Category.Id); Assert.AreEqual (56, response.Category.Id);
Assert.AreEqual ("sample category name2", response.Category.Name); Assert.AreEqual ("sample category name2", response.Category.Name);
@ -258,9 +258,9 @@ namespace IO.Swagger.Test
petApi.UpdatePetWithForm (petId, "new form name", "pending"); petApi.UpdatePetWithForm (petId, "new form name", "pending");
Pet response = petApi.GetPetById (petId); Pet response = petApi.GetPetById (petId);
Assert.IsInstanceOf<Pet> (response, "Response is a Pet"); Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");
Assert.IsInstanceOf<Category> (response.Category, "Response.Category is a Category"); Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array"); Assert.IsInstanceOfType(typeof(List<Tag>), response.Tags, "Response.Tags is a Array");
Assert.AreEqual ("new form name", response.Name); Assert.AreEqual ("new form name", response.Name);
Assert.AreEqual (Pet.StatusEnum.Pending, response.Status); Assert.AreEqual (Pet.StatusEnum.Pending, response.Status);

View File

@ -50,7 +50,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void InstanceTest() public void InstanceTest()
{ {
Assert.IsInstanceOf<StoreApi> (instance, "instance is a StoreApi"); Assert.IsInstanceOfType(typeof(StoreApi), instance, "instance is a StoreApi");
} }
@ -84,7 +84,7 @@ namespace IO.Swagger.Test
foreach(KeyValuePair<string, int?> entry in response) foreach(KeyValuePair<string, int?> entry in response)
{ {
Assert.IsInstanceOf (typeof(int?), entry.Value); Assert.IsInstanceOfType(typeof(int?), entry.Value);
} }
} }

View File

@ -49,7 +49,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void InstanceTest() public void InstanceTest()
{ {
Assert.IsInstanceOf<UserApi> (instance, "instance is a UserApi"); Assert.IsInstanceOfType(typeof(UserApi), instance, "instance is a UserApi");
} }

View File

@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -59,36 +59,38 @@ limitations under the License.
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="RestSharp"> <Reference Include="RestSharp">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> <HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> <HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.3.2.1\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('..\packages')">..\packages\NUnit.3.2.1\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.3.2.1\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.3.2.1\lib\nunit.framework.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="**\*.cs"/> <Compile Include="**\*.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\IO.Swagger\IO.Swagger.csproj"> <ProjectReference Include="..\IO.Swagger\IO.Swagger.csproj">
<Project>{EE727567-9CAF-4258-AA0E-FDF89487D7D6}</Project> <Project>{85AE8212-9819-4224-A9E5-B93419EC927B}</Project>
<Name>IO.Swagger</Name> <Name>IO.Swagger</Name>
</ProjectReference> </ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="swagger-logo.png" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void AdditionalPropertiesClassInstanceTest() public void AdditionalPropertiesClassInstanceTest()
{ {
Assert.IsInstanceOf<AdditionalPropertiesClass> (instance, "instance is a AdditionalPropertiesClass"); Assert.IsInstanceOfType(typeof(AdditionalPropertiesClass), instance, "instance is a AdditionalPropertiesClass");
} }

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void AnimalFarmInstanceTest() public void AnimalFarmInstanceTest()
{ {
Assert.IsInstanceOf<AnimalFarm> (instance, "instance is a AnimalFarm"); Assert.IsInstanceOfType(typeof(AnimalFarm), instance, "instance is a AnimalFarm");
} }

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void AnimalInstanceTest() public void AnimalInstanceTest()
{ {
Assert.IsInstanceOf<Animal> (instance, "instance is a Animal"); Assert.IsInstanceOfType(typeof(Animal), instance, "instance is a Animal");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void ApiResponseInstanceTest() public void ApiResponseInstanceTest()
{ {
Assert.IsInstanceOf<ApiResponse> (instance, "instance is a ApiResponse"); Assert.IsInstanceOfType(typeof(ApiResponse), instance, "instance is a ApiResponse");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void ArrayTestInstanceTest() public void ArrayTestInstanceTest()
{ {
Assert.IsInstanceOf<ArrayTest> (instance, "instance is a ArrayTest"); Assert.IsInstanceOfType(typeof(ArrayTest), instance, "instance is a ArrayTest");
} }

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void CatInstanceTest() public void CatInstanceTest()
{ {
Assert.IsInstanceOf<Cat> (instance, "instance is a Cat"); Assert.IsInstanceOfType(typeof(Cat), instance, "instance is a Cat");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void CategoryInstanceTest() public void CategoryInstanceTest()
{ {
Assert.IsInstanceOf<Category> (instance, "instance is a Category"); Assert.IsInstanceOfType(typeof(Category), instance, "instance is a Category");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void DogInstanceTest() public void DogInstanceTest()
{ {
Assert.IsInstanceOf<Dog> (instance, "instance is a Dog"); Assert.IsInstanceOfType(typeof(Dog), instance, "instance is a Dog");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void EnumClassInstanceTest() public void EnumClassInstanceTest()
{ {
Assert.IsInstanceOf<EnumClass> (instance, "instance is a EnumClass"); Assert.IsInstanceOfType(typeof(EnumClass), instance, "instance is a EnumClass");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void EnumTestInstanceTest() public void EnumTestInstanceTest()
{ {
Assert.IsInstanceOf<EnumTest> (instance, "instance is a EnumTest"); Assert.IsInstanceOfType(typeof(EnumTest), instance, "instance is a EnumTest");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void FormatTestInstanceTest() public void FormatTestInstanceTest()
{ {
Assert.IsInstanceOf<FormatTest> (instance, "instance is a FormatTest"); Assert.IsInstanceOfType(typeof(FormatTest), instance, "instance is a FormatTest");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest() public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest()
{ {
Assert.IsInstanceOf<MixedPropertiesAndAdditionalPropertiesClass> (instance, "instance is a MixedPropertiesAndAdditionalPropertiesClass"); Assert.IsInstanceOfType(typeof(MixedPropertiesAndAdditionalPropertiesClass), instance, "instance is a MixedPropertiesAndAdditionalPropertiesClass");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void Model200ResponseInstanceTest() public void Model200ResponseInstanceTest()
{ {
Assert.IsInstanceOf<Model200Response> (instance, "instance is a Model200Response"); Assert.IsInstanceOfType(typeof(Model200Response), instance, "instance is a Model200Response");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void ModelReturnInstanceTest() public void ModelReturnInstanceTest()
{ {
Assert.IsInstanceOf<ModelReturn> (instance, "instance is a ModelReturn"); Assert.IsInstanceOfType(typeof(ModelReturn), instance, "instance is a ModelReturn");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void NameInstanceTest() public void NameInstanceTest()
{ {
Assert.IsInstanceOf<Name> (instance, "instance is a Name"); Assert.IsInstanceOfType(typeof(Name), instance, "instance is a Name");
} }
/// <summary> /// <summary>

View File

@ -57,7 +57,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void OrderInstanceTest() public void OrderInstanceTest()
{ {
Assert.IsInstanceOf<Order> (instance, "instance is a Order"); Assert.IsInstanceOfType(typeof(Order), instance, "instance is a Order");
} }
/// <summary> /// <summary>

View File

@ -49,7 +49,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void PetInstanceTest() public void PetInstanceTest()
{ {
Assert.IsInstanceOf<Pet> (instance, "instance is a Pet"); Assert.IsInstanceOfType(typeof(Pet), instance, "instance is a Pet");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void ReadOnlyFirstInstanceTest() public void ReadOnlyFirstInstanceTest()
{ {
Assert.IsInstanceOf<ReadOnlyFirst> (instance, "instance is a ReadOnlyFirst"); Assert.IsInstanceOfType(typeof(ReadOnlyFirst), instance, "instance is a ReadOnlyFirst");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void SpecialModelNameInstanceTest() public void SpecialModelNameInstanceTest()
{ {
Assert.IsInstanceOf<SpecialModelName> (instance, "instance is a SpecialModelName"); Assert.IsInstanceOfType(typeof(SpecialModelName), instance, "instance is a SpecialModelName");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void TagInstanceTest() public void TagInstanceTest()
{ {
Assert.IsInstanceOf<Tag> (instance, "instance is a Tag"); Assert.IsInstanceOfType(typeof(Tag), instance, "instance is a Tag");
} }
/// <summary> /// <summary>

View File

@ -47,7 +47,7 @@ namespace IO.Swagger.Test
[Test] [Test]
public void UserInstanceTest() public void UserInstanceTest()
{ {
Assert.IsInstanceOf<User> (instance, "instance is a User"); Assert.IsInstanceOfType(typeof(User), instance, "instance is a User");
} }
/// <summary> /// <summary>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="NUnit" version="2.6.3" targetFramework="net45" /> <package id="NUnit" version="3.2.1" targetFramework="net45" />
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" /> <package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" developmentDependency="true" /> <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" developmentDependency="true" />
</packages> </packages>

View File

@ -1,7 +1,36 @@
/*
* 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
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System; using System;
using RestSharp; using RestSharp;
namespace IO.Swagger.Client namespace IO.Swagger.Client
{ {
/// <summary>
/// A delegate to ExceptionFactory method
/// </summary>
/// <param name="methodName">Method name</param>
/// <param name="response">Response</param>
/// <returns>Exceptions</returns>
public delegate Exception ExceptionFactory(string methodName, IRestResponse response); public delegate Exception ExceptionFactory(string methodName, IRestResponse response);
} }

View File

@ -24,7 +24,7 @@ limitations under the License.
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EE727567-9CAF-4258-AA0E-FDF89487D7D6}</ProjectGuid> <ProjectGuid>{7B20DAE3-B510-4814-8986-CF1B89EA039E}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Swagger Library</RootNamespace> <RootNamespace>Swagger Library</RootNamespace>
@ -59,10 +59,10 @@ limitations under the License.
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="RestSharp"> <Reference Include="RestSharp">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" /> <package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" developmentDependency="true" /> <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" developmentDependency="true" />
</packages> </packages>