dennisdoomen/fluentassertions — pull request #64 by samholder (2014-01-12 18:45:03+00:00)
Title: Added an AndWhichConstraint

Hi.

I'm proposing an additional class, AndWhichConstraint, which allows access to the matched instance from another constraint so that further validations can be made on the matched instance. For example given this:

XElement xElement = XElement.Parse(@"

");

then this sort of validation becomes possible:

xElement.Should().HaveElement("child").Which.Should().HaveAttribute("someAttribute",""1");

I have only used it in the XDocumentAssertions and XElementAssertions classes, but if you think this is a reasonable idea then I think there are other places in the library where it could be used, basically anywhere where a match of some object is done as part of the validation.

I was unable to load the silverlight/winRT/windowsPhone projects so I hope that my manual editing of the .cs files in them is ok!