-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed command line, updated packages, added unit test, v2.12
- Loading branch information
Showing
26 changed files
with
852 additions
and
816 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/NSwag.CodeGeneration.Tests/CommandLine/WebApiCommandLineTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Diagnostics; | ||
using System.IO; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace NSwag.CodeGeneration.Tests.CommandLine | ||
{ | ||
[TestClass] | ||
public class WebApiCommandLineTests | ||
{ | ||
[TestMethod] | ||
public void When_webapi2swagger_is_called_then_file_is_created() | ||
{ | ||
//// Arrange | ||
if (File.Exists("MyWebService.json")) | ||
File.Delete("MyWebService.json"); | ||
|
||
var command = "webapi2swagger " + | ||
"/assembly:" + Path.GetFullPath("../../../NSwag.Demo.Web/bin/NSwag.Demo.Web.dll") + " " + | ||
"/controller:NSwag.Demo.Web.Controllers.PersonsController " + | ||
"/output:MyWebService.json"; | ||
|
||
//// Act | ||
var process = Process.Start(new ProcessStartInfo | ||
{ | ||
FileName = Path.GetFullPath("../../../NSwag/bin/" + (Directory.GetCurrentDirectory().Contains("bin\\Release") ? "Release" : "Debug") + "/NSwag.exe"), | ||
Arguments = command, | ||
}); | ||
|
||
if (!process.WaitForExit(5000)) | ||
process.Kill(); | ||
|
||
var json = File.ReadAllText("MyWebService.json"); | ||
|
||
//// Assert | ||
Assert.IsTrue(!string.IsNullOrEmpty(json)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> | ||
<package id="NJsonSchema" version="2.10.5958.25556" targetFramework="portable45-net45+win8+wp8+wpa81" /> | ||
<package id="NJsonSchema" version="2.11.5963.474" targetFramework="portable45-net45+win8+wp8+wpa81" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Antlr4.StringTemplate" version="4.0.6.9004" targetFramework="net452" /> | ||
<package id="NConsole" version="1.2.5854.14777" targetFramework="net45" /> | ||
<package id="NConsole" version="1.3.5963.27533" targetFramework="net46" /> | ||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> | ||
<package id="NJsonSchema" version="2.10.5958.25556" targetFramework="net46" /> | ||
<package id="NJsonSchema.CodeGeneration" version="2.10.5958.25557" targetFramework="net46" /> | ||
<package id="NJsonSchema" version="2.11.5963.474" targetFramework="net46" /> | ||
<package id="NJsonSchema.CodeGeneration" version="2.11.5963.475" targetFramework="net46" /> | ||
</packages> |
Oops, something went wrong.