.Net fluent MVC assertions

A really neat package for unit testing MVC controllers, it’s called TestStack.FluentMVCTesting and looks like:

using TestStack.FluentMVCTesting;
...
[Test]
...
          _Controller
                .WithCallTo(c => c.Action())
                .ShouldRenderView("View")
                .WithModel<Model>(
                    m =>
                    {
                        m.name.Should().NotBeNull();
                        m.Offers.Count().Should().Be(3);
                        RunOfferAssertions(m.Offers.First());
                    })
                .AndNoModelErrors();
...

Leave a Reply

Your email address will not be published. Required fields are marked *