csharp-netcore.api_test.mustache Maven / Gradle / Ivy
The newest version!
{{>partial_header}}
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using RestSharp;
using Xunit;
using {{packageName}}.Client;
using {{packageName}}.{{apiPackage}};
{{#hasImport}}using {{packageName}}.{{modelPackage}};
{{/hasImport}}
namespace {{packageName}}.Test
{
///
/// Class for testing {{classname}}
///
///
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the API endpoint.
///
public class {{classname}}Tests : IDisposable
{
private {{classname}} instance;
public {{classname}}Tests()
{
instance = new {{classname}}();
}
public void Dispose()
{
// Cleanup when everything is done.
}
///
/// Test an instance of {{classname}}
///
[Fact]
public void {{operationId}}InstanceTest()
{
// TODO uncomment below to test 'IsInstanceOfType' {{classname}}
//Assert.IsType(typeof({{classname}}), instance, "instance is a {{classname}}");
}
{{#operations}}{{#operation}}
///
/// Test {{operationId}}
///
[Fact]
public void {{operationId}}Test()
{
// TODO uncomment below to test the method and replace null with proper value
{{#allParams}}
//{{{dataType}}} {{paramName}} = null;
{{/allParams}}
//{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{#returnType}}//Assert.IsType<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}}
}
{{/operation}}{{/operations}}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy