Charlie Poole
2008-09-06 02:18:00 UTC
Hi All,
I just checked in a large set of changes that update how we
handle processing of constraint expressions.
I'm much happier than before with both how it works and
with the internal structure.
I'll be updating the docs and probably blogging about this,
but here are a few key points, expressed as valid constraint
expressions...
// The change I posted about recently
Has.Count.GreaterThan(0)
Has.Message.StartingWith("Error");
Has.Property("Age").InRange(21,99)
// These two mean different things! (*)
Has.Some.GreaterThan(0).And.Some.LessThan(42);
Has.Some.GreaterThan(0).And.LessThan(42)
(*) Normally Some, All, and None wrap the entire expression
following them, including any binary operators. But the
binary operators are context-sensitive and know to increase
their precedence level when directly followed by any of these.
// Exception no longer takes an argument
Throws.Exception
Throws.Exception.TypeOf<ArgumentException>()
Throws.TypeOf<ArgumentException>() // Same as preceding
Throws.Exception.InstanceOf<ArgumentException>()
Throws.InstanceOf<ArgumentException>() // Same as preceding
Throws.Exception.With.Message.Containing("my message")
Throws.TypeOf(typeof(ArgumentException))
.With.Property("ParamName").EqualTo("myparam")
.And.Message.Containing("some string")
I listed a lot of Throws examples because
1. It's new, and
2. If you remember, implementing the .With. form of throws
was a major motivator for all this restructuring.
In addition, the intellisense is now much better, no longer
inviting you to type two "Ands" in a row, for example.
Getting this done will also make it possible for me to integrate
some new items that were contributed by several of you - thanks
for your patience.
Charlie
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
I just checked in a large set of changes that update how we
handle processing of constraint expressions.
I'm much happier than before with both how it works and
with the internal structure.
I'll be updating the docs and probably blogging about this,
but here are a few key points, expressed as valid constraint
expressions...
// The change I posted about recently
Has.Count.GreaterThan(0)
Has.Message.StartingWith("Error");
Has.Property("Age").InRange(21,99)
// These two mean different things! (*)
Has.Some.GreaterThan(0).And.Some.LessThan(42);
Has.Some.GreaterThan(0).And.LessThan(42)
(*) Normally Some, All, and None wrap the entire expression
following them, including any binary operators. But the
binary operators are context-sensitive and know to increase
their precedence level when directly followed by any of these.
// Exception no longer takes an argument
Throws.Exception
Throws.Exception.TypeOf<ArgumentException>()
Throws.TypeOf<ArgumentException>() // Same as preceding
Throws.Exception.InstanceOf<ArgumentException>()
Throws.InstanceOf<ArgumentException>() // Same as preceding
Throws.Exception.With.Message.Containing("my message")
Throws.TypeOf(typeof(ArgumentException))
.With.Property("ParamName").EqualTo("myparam")
.And.Message.Containing("some string")
I listed a lot of Throws examples because
1. It's new, and
2. If you remember, implementing the .With. form of throws
was a major motivator for all this restructuring.
In addition, the intellisense is now much better, no longer
inviting you to type two "Ands" in a row, for example.
Getting this done will also make it possible for me to integrate
some new items that were contributed by several of you - thanks
for your patience.
Charlie
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/