drunkcod / Cone

8 stars 1 forks source link

Verify.Exception ought to support Func lambdas #9

Closed neochrome closed 13 years ago

neochrome commented 13 years ago

Current implementation supports action lambdas like increment/decrement and method calls. Example:

class Foo
{
    public void Bar() { throw new Exception(); }
    public int Baz { get { throw new Exception(); } }
}

Verify.Exception<Exception>(() => new Foo().Bar());

It would also be great to have it support func lambdas like property access. Example:

Verify.Exception<Exception>(() => new Foo().Baz);
drunkcod commented 13 years ago

Support for expressions with return values will be in 0.0.2.12, also introducing a new syntax: Verify.Throws.When(() => ...) this to get a uniform feel for both actions and functions.

drunkcod commented 13 years ago

Closing this, it's in head :)