csharp-netcore.model_test.mustache Maven / Gradle / Ivy
{{>partial_header}}
using Xunit;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using {{packageName}}.{{apiPackage}};
using {{packageName}}.{{modelPackage}};
using {{packageName}}.Client;
using System.Reflection;
using Newtonsoft.Json;
{{#models}}
{{#model}}
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 model.
///
public class {{classname}}Tests : IDisposable
{
// TODO uncomment below to declare an instance variable for {{classname}}
//private {{classname}} instance;
public {{classname}}Tests()
{
// TODO uncomment below to create an instance of {{classname}}
//instance = new {{classname}}();
}
public void Dispose()
{
// Cleanup when everything is done.
}
///
/// Test an instance of {{classname}}
///
[Fact]
public void {{classname}}InstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" {{classname}}
//Assert.IsInstanceOfType<{{classname}}> (instance, "variable 'instance' is a {{classname}}");
}
{{#discriminator}}
{{#children}}
///
/// Test deserialize a {{classname}} from type {{parent}}
///
[Fact]
public void {{classname}}DeserializeFrom{{parent}}Test()
{
// TODO uncomment below to test deserialize a {{classname}} from type {{parent}}
//Assert.IsInstanceOf<{{parent}}>(JsonConvert.DeserializeObject<{{parent}}>(new {{classname}}().ToJson()));
}
{{/children}}
{{/discriminator}}
{{#vars}}
///
/// Test the property '{{name}}'
///
[Fact]
public void {{name}}Test()
{
// TODO unit test for the property '{{name}}'
}
{{/vars}}
}
}
{{/model}}
{{/models}}