Skip to content

Commit 5ea8518

Browse files
committed
Added unit tests for IsUsing method in MyWebApi (#139)
1 parent bf0e4b0 commit 5ea8518

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/MyWebApi.Tests/MyWebApiTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
namespace MyWebApi.Tests
1818
{
19+
using System.Web.Http;
1920
using Exceptions;
2021
using NUnit.Framework;
2122
using Setups.Controllers;
@@ -24,6 +25,22 @@ namespace MyWebApi.Tests
2425
[TestFixture]
2526
public class MyWebApiTests
2627
{
28+
[Test]
29+
public void IsUsingShouldOverrideTheDefaultConfiguration()
30+
{
31+
var config = new HttpConfiguration();
32+
MyWebApi.IsUsing(config);
33+
34+
// run two test cases in order to check the configuration is global
35+
for (int i = 0; i < 2; i++)
36+
{
37+
var controller = MyWebApi.Controller<WebApiController>().Controller;
38+
var actualConfig = controller.Configuration;
39+
40+
Assert.AreSame(config, actualConfig);
41+
}
42+
}
43+
2744
[Test]
2845
public void ControllerWithoutConstructorFunctionShouldPopulateCorrectNewInstanceOfControllerType()
2946
{

0 commit comments

Comments
 (0)