The consensus among the community appears to be that each test should have but one logical assertion.
If a developer wants to test that a controller returns a model of the correct type explicitly, they must also test that a view with a particular name is rendered - that's two logical assertions.
[Test]
public void Index_ReturnsCorrectModelType()
{
repository
.Setup(repo => repo.All())
.Returns(PostsMother.CreateEmptyPosts());
controller
.WithCallTo(c => c.Index(1))
.ShouldRenderDefaultView()
.WithModel<PagedList<Post>>();
}
I suspect that this kind of test goes against your philosophy but I am going to bring it up for discussion anyway.
Links:
The consensus among the community appears to be that each test should have but one logical assertion.
If a developer wants to test that a controller returns a model of the correct type explicitly, they must also test that a view with a particular name is rendered - that's two logical assertions.
I suspect that this kind of test goes against your philosophy but I am going to bring it up for discussion anyway.
Links: