Skip to content

Commit 94de4d9

Browse files
committed
Make tests compatible with NUnit 3.5
1 parent ed323d7 commit 94de4d9

4 files changed

Lines changed: 17 additions & 15 deletions

File tree

tests/ServiceStack.ServiceHost.Tests/Formats_Razor/PrecompiledRazorEngineTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@ public void Pages_with_errors_dont_cause_exceptions_on_thread_starting_the_preco
5454
Assert.That(page.CompileException, Is.Not.Null);
5555
}
5656

57-
[ExpectedException(typeof(HttpCompileException))]
5857
[Test]
5958
public void Pages_with_errors_still_throw_exceptions_when_rendering()
6059
{
6160
const string template = "This is a bad template, Hello @SomeInvalidMember.Name!";
62-
RazorFormat.AddFileAndPage("/simple.cshtml", template);
6361

64-
RazorFormat.RenderToHtml("/simple.cshtml", new { Name = "World" });
62+
Assert.Throws<HttpCompileException>(() => {
63+
RazorFormat.AddFileAndPage("/simple.cshtml", template);
64+
RazorFormat.RenderToHtml("/simple.cshtml", new { Name = "World" });
65+
});
6566
}
6667
}
6768

tests/ServiceStack.ServiceHost.Tests/RestPathTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,12 @@ private static void AssertNoMatch(string definitionPath, string requestPath)
275275
}
276276

277277
[Test]
278-
[ExpectedException(typeof(ArgumentException))]
279278
public void Cannot_have_variable_after_wildcard()
280279
{
281-
AssertMatch("/content/{Slug*}/{Version}",
282-
"/content/wildcard/slug/path/1", "*/content", new SlugRequest(), -1);
280+
Assert.Throws<ArgumentException>(() => {
281+
AssertMatch("/content/{Slug*}/{Version}",
282+
"/content/wildcard/slug/path/1", "*/content", new SlugRequest(), -1);
283+
});
283284
}
284285

285286
[Test]

tests/ServiceStack.ServiceHost.Tests/UseCase/CustomerUseCase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
namespace ServiceStack.ServiceHost.Tests.UseCase
1818
{
19-
[Ignore]
19+
[Ignore("Performance tests")]
2020
[TestFixture]
2121
public class CustomerUseCase
2222
{

tests/ServiceStack.ServiceModel.Tests/XlinqExtensionsTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ public void xelement_get_int_test()
2828
}
2929

3030
[Test]
31-
[ExpectedException(typeof(ArgumentNullException))]
3231
public void xelement_get_int_null_throws_exception_test()
3332
{
34-
var el = CreateEmptyChildElement();
35-
el.GetInt("child");
36-
Assert.Fail("Expected ArgumentNullException");
33+
Assert.Throws<ArgumentNullException>(() => {
34+
var el = CreateEmptyChildElement();
35+
el.GetInt("child");
36+
});
3737
}
3838

3939
[Test]
40-
[ExpectedException(typeof(FormatException))]
4140
public void xelement_get_int_text_throws_exception_test()
4241
{
43-
var el = CreateChildElement("Non int value");
44-
el.GetInt("child");
45-
Assert.Fail("Expected FormatException");
42+
Assert.Throws<FormatException>(() => {
43+
var el = CreateChildElement("Non int value");
44+
el.GetInt("child");
45+
});
4646
}
4747

4848
[Test]

0 commit comments

Comments
 (0)