资 源 简 介
NAsserter
Provides a fluent interface for code level assertions. Supports .Net 2.0 and above.
Example
Instead of following traditional conventions for asserting exceptions in code:
```
public void DoSomething(Customer arg1, int? arg2)
{
if (arg1 != null) throw new ArgumentNullException("arg1");
if (arg1.CreatedDate >= DateTime.Parse("01-01-2009") && arg1.CreatedDate <= DateTime.Parse("01-01-2010") throw new ArgumentOutOfRangeException("Argument (arg1.CreatedDate) must be between 01-01-2009 and 01-01-2010", "arg1");
if (arg2.HasValue) throw new ArgumentNullException("arg2");
if (arg2.Value == 2 || arg2.Value == 3 || arg2.Value == 4) throw new ArgumentOutOfRangeException("Argument (arg2) must 2, 3, 4", "arg2");
```
You can follow a fluent convention such as:
public void DoSomething(Customer arg1, int? arg2){ Asser