Skip to content

Commit

Permalink
minor filename change
Browse files Browse the repository at this point in the history
  • Loading branch information
mariodivece committed Apr 12, 2016
1 parent 8db97a8 commit 0f06340
Show file tree
Hide file tree
Showing 3 changed files with 413 additions and 344 deletions.
69 changes: 69 additions & 0 deletions Unosquare.Labs.EmbedIO.Tests/RegExRoutingTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using Unosquare.Labs.EmbedIO.Modules;
using Unosquare.Labs.EmbedIO.Tests.Properties;
using Unosquare.Labs.EmbedIO.Tests.TestObjects;

namespace Unosquare.Labs.EmbedIO.Tests
{
[TestFixture]
public class RegExRoutingTest
{
protected WebServer WebServer;
protected TestConsoleLog Logger = new TestConsoleLog();

[SetUp]
public void Init()
{
WebServer =
new WebServer(Resources.ServerAddress, Logger, RoutingStrategy.RegEx)
.WithWebApiController<TestRegexController>();
WebServer.RunAsync();
}

[Test]
public void TestWebApi()
{
Assert.IsNotNull(WebServer.Module<WebApiModule>(), "WebServer has WebApiModule");

Assert.AreEqual(WebServer.Module<WebApiModule>().ControllersCount, 1, "WebApiModule has one controller");
}

[Test]
public void GetJsonDataWithRegexId()
{
TestHelper.ValidatePerson(Resources.ServerAddress + TestRegexController.RelativePath + "regex/1");
}

[Test]
public void GetJsonDatAsyncaWithRegexId()
{
TestHelper.ValidatePerson(Resources.ServerAddress + TestRegexController.RelativePath + "regexasync/1");
}

[Test]
public void GetJsonDataWithRegexDate()
{
var person = PeopleRepository.Database.First();
TestHelper.ValidatePerson(Resources.ServerAddress + TestRegexController.RelativePath + "regexdate/" +
person.DoB.ToString("yyyy-MM-dd"));
}

[Test]
public void GetJsonDataWithRegexWithTwoParams()
{
var person = PeopleRepository.Database.First();
TestHelper.ValidatePerson(Resources.ServerAddress + TestRegexController.RelativePath + "regextwo/" +
person.MainSkill + "/" + person.Age);
}

[TearDown]
public void Kill()
{
Thread.Sleep(TimeSpan.FromSeconds(1));
WebServer.Dispose();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="RegExRoutesTest.cs" />
<Compile Include="RegExRoutingTest.cs" />
<Compile Include="StaticFilesModuleTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestObjects\PeopleRepository.cs" />
Expand Down
Loading

0 comments on commit 0f06340

Please sign in to comment.