All Downloads are FREE. Search and download functionalities are using the official Maven repository.

csharp.api_test.mustache Maven / Gradle / Ivy

There is a newer version: 3.0.0-rc1
Show newest version
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using RestSharp;
using NUnit.Framework;

using {{packageName}}.Client;
using {{packageName}}.Api;
{{#hasImport}}using {{packageName}}.Model;
{{/hasImport}}

namespace {{packageName}}.Test
{
    /// 
    ///  Class for testing {{classname}}
    /// 
    /// 
    /// This file is automatically generated by Swagger Codegen.
    /// Please update the test case below to test the API endpoint.
    /// 
    [TestFixture]
    public class {{classname}}Tests
    {
        private {{classname}} instance;

        /// 
        /// Setup before each unit test
        /// 
        [SetUp]
        public void Init()
        {
           instance = new {{classname}}();
        }

        /// 
        /// Clean up after each unit test
        /// 
        [TearDown]
        public void Cleanup()
        {

        }

        /// 
        /// Test an instance of {{classname}}
        /// 
        [Test]
        public void {{operationId}}InstanceTest()
        {
            Assert.IsInstanceOf<{{classname}}> (instance, "instance is a {{classname}}");
        }

        {{#operations}}{{#operation}}
        /// 
        /// Test {{operationId}}
        /// 
        [Test]
        public void {{operationId}}Test()
        {
            // TODO: add unit test for the method '{{operationId}}'
            {{#allParams}}{{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value
            {{/allParams}}
            {{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
            {{#returnType}}Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}} 
        }
        {{/operation}}{{/operations}}
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy