Tests with Web API - API Documentation Tools - API Help Pages and Swagger
Swagger is a API Documentation Tool, intagrated on Visual Studio by Nuget Packages
See more at Swagger website.
I´m using Swashbuckle Visual Studio Nuget Package
To see a tutorial using .NET Web API and Swagger see more at Swashbuckle GitHub Repo
See Swagger UI in action bellow
.NET Web API - Help Pages is a collection of Views to Genarate API Help Pages
I´m using WebApiTestClient too, to add a Test Client on API Help Pages. If you want, you see how to add WebApiTestClient into this tutorial Adding a simple Test Client to ASP.NET Web API Help Page
See more at HelpPages on Microsoft Website. This MS Blog Post is usefull too Introducing the ASP.NET Web API Help Page.
See Web API Test Client bellow
To enable Swagger to use XmlDoc, use
c.IncludeXmlComments(GetXmlCommentsPath());
I suggested to place XmlDoc in App_Data Folder above a sample of GetXmlCommentsPath()
method
private static string GetXmlCommentsPath()
{
var basePath = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/");
var xmlDocPath = System.IO.Path.Combine(basePath, "XmlDocument.xml");
return xmlDocPath;
}
Sample code - XmlDoc to Genarate API Doc
/// <summary>
/// Obtêm todos os produtos
/// </summary>
/// <returns>Retorna uma lista com todos os produtos</returns>
public List<Models.Produto> Get()
{
return produtos;
}