With the conditions in Fluent Tests you’ll cast the object automatically when asserting.

var customerController = new CustomerController();
var
result = customerController.Details(3);

Ensure.That(result).Is.InstanceOfType<ViewResult
>()
     .And(a => a.Model).Is.InstanceOfType<
Customer
>()
     .And(a => a.FirstName).Is.EqualTo(
"Charlie");
 


This way you get to write the unit test clear and without all the noise you get when declaring variables and doing casts.

See more at http://tidycode.wordpress.com

Last edited Jun 20, 2011 at 10:25 PM by Arvander, version 2

Comments

No comments yet.