public void CheckIsOfType02() { object param = null; UseCaseTestHelper.Test(() => { // Use Case: this is what the use would write without conditions. if (!(param is string)) { if (param == null) { throw new ArgumentNullException("param", "param should not be of type string."); } else { throw new ArgumentException("param should not be of type string.", "param"); } } }, () => { // This is what the user should write with conditions. Condition.Requires(param, "param").IsOfType(typeof(string)); }); }
public void CheckIsNull02() { object param = null; UseCaseTestHelper.Test(() => { // Use Case: this is what the user would write without conditions. if (param != null) { throw new ArgumentException("param should not be null.", "param"); } }, () => { // This is what the user should write with conditions. Condition.Requires(param, "param").IsNull(); }); }