Skip to content

Commit 19780c5

Browse files
committed
#283 Fixed missing test assertion for exception.
1 parent 5cccc09 commit 19780c5

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

test/MyTested.AspNetCore.Mvc.EntityFrameworkCore.Test/BuildersTests/ControllersTests/ControllerBuilderTests.cs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -460,23 +460,26 @@ public void WithoutDataDeletingWholeDatabaseReturnsCorrectData()
460460
[Fact]
461461
public void WithoutDataThrowsExceptionWhenNullIsProvided()
462462
{
463-
MyApplication
463+
Test.AssertException<ArgumentNullException>(() =>
464+
{
465+
MyApplication
464466
.StartsFrom<TestStartup>()
465467
.WithServices(services => services.AddDbContext<CustomDbContext>());
466468

467-
var model = new CustomModel
468-
{
469-
Id = 1,
470-
Name = "Test"
471-
};
472-
473-
MyController<DbContextController>
474-
.Instance()
475-
.WithData(model)
476-
.WithoutData(default(List<object>))
477-
.Calling(c => c.Get(model.Id))
478-
.ShouldReturn()
479-
.NotFound();
469+
var model = new CustomModel
470+
{
471+
Id = 1,
472+
Name = "Test"
473+
};
474+
475+
MyController<DbContextController>
476+
.Instance()
477+
.WithData(model)
478+
.WithoutData(default(List<object>))
479+
.Calling(c => c.Get(model.Id))
480+
.ShouldReturn()
481+
.NotFound();
482+
}, "Value cannot be null.\r\nParameter name: entities");
480483
}
481484

482485
[Fact]

0 commit comments

Comments
 (0)