TestStack/TestStack.FluentMVCTesting — pull request #4 by segilbert (2013-02-17 21:09:03+00:00)
Title: Viewbagdatasupport

Added support for fluent validation for ViewBag and ViewData in the ViewResultTest class using WithViewBag and WithViewData methods respectively. Added ImpromptuInterface reference to check ViewBag dynamic collection for member name passed in.

http://nuget.org/packages/ImpromptuInterface/

Added unit tests in ViewResultTestTests class to validate 2 new methods.

Use: Adding unit test for ASP.NET MVC default HomeController

[Fact]
public void Index_RenderView_WithViewBagMessage()
{
// Arrange
HomeController controller = new HomeController();

// Act
// Assert
controller.WithCallTo(c => c.Index())
.ShouldRenderDefaultView()
.WithViewBag("Message")
.Should()
.Be("Modify this template to jump-start your ASP.NET MVC application.");

}