Skip to content

Commit

Permalink
Added route test for async methods (closes #257, closes #258)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivaylokenov committed Apr 10, 2016
1 parent 7e06c8b commit 859ac32
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ public void ToShouldResolveCorrectlyWithDefaultGetMethod()
.To<RouteController>(c => c.GetMethod());
}

[Test]
public void ToShouldResolveCorrectlyAsyncMethods()
{
MyWebApi
.Routes()
.ShouldMap("api/Route/AsyncAction")
.To<RouteController>(c => c.AsyncAction());
}

[Test]
public void ToShouldResolveCorrectlyWithFullQueryString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
namespace MyTested.WebApi.Tests.Setups.Controllers
{
using System.Threading.Tasks;
using System.Web.Http;
using Models;
using Services;
Expand Down Expand Up @@ -97,5 +98,11 @@ public IHttpActionResult SameAction(ResponseModel model)
{
return this.Ok();
}

[HttpGet]
public async Task<IHttpActionResult> AsyncAction()
{
return await Task.Run(() => this.Ok());
}
}
}

0 comments on commit 859ac32

Please sign in to comment.