We cannot use ShouldHaveValidationErrorFor and ShouldNotHaveValidationErrorFor methods for nested properties. For example, for tested class has a property of another class. For example, we cannot write:
validator.ShouldHaveValidationErrorFor(x => x.AddNewComment.CommentText, model);
For more info please get the latest development version of nopCommerce (open source shopping cart). It's not an official release yet, so get it here http://nopcommerce.codeplex.com/SourceControl/list/changesets . Open Nop.Web.MVC.Tests project, then \Public\Validators\Blogs\BlogPostValidatorTests.cs unit test file. Look at its implementation
validator.ShouldHaveValidationErrorFor(x => x.AddNewComment.CommentText, model);
For more info please get the latest development version of nopCommerce (open source shopping cart). It's not an official release yet, so get it here http://nopcommerce.codeplex.com/SourceControl/list/changesets . Open Nop.Web.MVC.Tests project, then \Public\Validators\Blogs\BlogPostValidatorTests.cs unit test file. Look at its implementation