-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
312 additions
and
82 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
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
9 changes: 0 additions & 9 deletions
9
Unosquare.Labs.EmbedIO.Command/Properties/Settings.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
namespace Unosquare.Labs.EmbedIO.Tests | ||
{ | ||
using NUnit.Framework; | ||
using System.Net; | ||
using Unosquare.Labs.EmbedIO.Modules; | ||
using Unosquare.Labs.EmbedIO.Tests.Properties; | ||
|
||
[TestFixture] | ||
public class FluentTest | ||
{ | ||
protected string RootPath; | ||
|
||
[SetUp] | ||
public void Init() | ||
{ | ||
RootPath = TestHelper.SetupStaticFolder(); | ||
} | ||
|
||
[Test] | ||
public void FluentWithStaticFolder() | ||
{ | ||
var webServer = WebServer.Create(Resources.ServerAddress) | ||
.WithLocalSession() | ||
.WithStaticFolderAt(RootPath); | ||
|
||
Assert.AreEqual(webServer.Modules.Count, 2, "It has 2 modules loaded"); | ||
Assert.IsNotNull(webServer.Module<StaticFilesModule>(), "It has StaticFilesModule"); | ||
Assert.AreEqual(webServer.Module<StaticFilesModule>().FileSystemPath, RootPath, "StaticFilesModule root path is equal to RootPath"); | ||
|
||
webServer.RunAsync(); | ||
|
||
var request = (HttpWebRequest)WebRequest.Create(Resources.ServerAddress); | ||
|
||
using (var response = (HttpWebResponse)request.GetResponse()) | ||
{ | ||
Assert.AreEqual(response.StatusCode, HttpStatusCode.OK, "Status Code OK"); | ||
} | ||
|
||
webServer.Dispose(); | ||
} | ||
|
||
[Test] | ||
public void FluentWithWebApi() | ||
{ | ||
var webServer = WebServer.Create(Resources.ServerAddress) | ||
.WithWebApi(autoload: true, assembly: typeof(FluentTest).Assembly); | ||
|
||
Assert.AreEqual(webServer.Modules.Count, 1, "It has 1 modules loaded"); | ||
Assert.IsNotNull(webServer.Module<WebApiModule>(), "It has WebApiModule"); | ||
Assert.AreEqual(webServer.Module<WebApiModule>().ControllersCount, 1, "It has one controller"); | ||
|
||
webServer.Dispose(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.