-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathapi_test.mustache
77 lines (71 loc) · 2.09 KB
/
api_test.mustache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{{>partial_header}}
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
{{#useRestSharp}}
using RestSharp;
{{/useRestSharp}}
using Xunit;
using {{packageName}}.Client;
using {{packageName}}.{{apiPackage}};
{{#hasImport}}
// uncomment below to import models
//using {{packageName}}.{{modelPackage}};
{{/hasImport}}
namespace {{packageName}}.Test.Api
{
/// <summary>
/// Class for testing {{classname}}
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the API endpoint.
/// </remarks>
public class {{classname}}Tests : IDisposable
{
{{^nonPublicApi}}
private {{classname}} instance;
{{/nonPublicApi}}
public {{classname}}Tests()
{
{{^nonPublicApi}}
instance = new {{classname}}();
{{/nonPublicApi}}
}
public void Dispose()
{
// Cleanup when everything is done.
}
/// <summary>
/// Test an instance of {{classname}}
/// </summary>
[Fact]
public void {{operationId}}InstanceTest()
{
// TODO uncomment below to test 'IsType' {{classname}}
//Assert.IsType<{{classname}}>(instance);
}
{{#operations}}
{{#operation}}
/// <summary>
/// Test {{operationId}}
/// </summary>
[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}}{{^-last}}, {{/-last}}{{/allParams}});
{{#returnType}}
//Assert.IsType<{{{.}}}>(response);
{{/returnType}}
}
{{/operation}}
{{/operations}}
}
}