** Project changed: nunitv2 => nunit-3.0

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1099517

Title:
  Assert.That with Throws should allow asserting on lambda property

Status in NUnit Test Framework:
  Triaged

Bug description:
  To assert a property name, one can use the following
      Assert.That (testDelegate, 
Throws.ArgumentException.With.Property("ParamName").EqualTo ("name"));
  or this one, as a refactor-friendly way
      Assert.That (testDelegate, 
Throws.ArgumentException.And.Matches<ArgumentException> (x => x.ParamName == 
"name"));
  It works but the error text reported when the assert is not satisfied is 
rather generic:
       Expected: <System.ArgumentException> and value matching lambda expression

  There should be an easier way to express the intent and have a better error 
message, something like:
       Assert.That (testDelegate, Throws.ArgumentException.And.Property(ex => 
ex.ParamName).EqualTo ("name"));

  with the error reporting:
       Expected: Property lambda ex.ParamName with value "name"
       but got
       Property lambda ex.ParamName with value "myParam"

  TestCaseData migh also benefit from this if it implemented the lambda
  property functionality.

  As discussed here: https://groups.google.com/forum/#!topic/nunit-
  discuss/Fg0oFzR8owE

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunit-3.0/+bug/1099517/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~nunit-core
Post to     : nunit-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~nunit-core
More help   : https://help.launchpad.net/ListHelp

Reply via email to