Previously useful in the project to Webapi external interface, found in the project has based on WEBAPI methods and comments automatically generated help documents, can also test Webapi method, the function is very powerful, now take out to share with you.
First look at the generated WEBAPI document.
1, the display is the first page of the build Help document, where values is controller,api The following list shows the requested HTTP method (Get,post, etc.), the requested action, the description of the method.
2. Click the link in the red box to open the details page of the API method, as shown in
3. Click the test API to open the following page
4, input parameters, click the Send button, open the following page, you can see the return value.
Here are the steps to set up the method:
Development environment VS2012 + MVC4 + WEB API
1. Referencing the web API Test Client through NuGet
References to play the DLL generate the following files:
This is our help. Document interface
2. In the project properties, make the following settings, tick the XML document file, and set the path
3. Create xmldocument.xml under the App_Data folder of the project
4. Open the \areas\helppage\app_start\helppageconfig.cs file and uncomment the following code
Run the project, open Http://localhost:3619/Help, and see the automatically generated API documentation, which is a picture of the article
Click to download the project code
Reference: http://www.c-sharpcorner.com/UploadFile/2b481f/adding-the-test-api-in-the-Asp-Net-web-api-help-page/
Web API automatically generates help documents and uses Web API test Client Testing