public void ThrowArgumentOutOfRangeException_WhenTheFirstMatchingValidationRuleIsRangeRule() { // Arrange. IValidatableArgument<int> argument = new ValidatableArgument<int>("argument", 5); argument.IsEqual(3).IsLessThan(10); // Act & Assert. Ensure.ArgumentOutOfRangeExceptionIsThrown( () => { argument.Throw(); }, "argument"); }
public void ThrowArgumentException_WhenTheFirstMachingValidationRuleIsEqual() { // Arrange. IValidatableArgument<string> argument = new ValidatableArgument<string>("argument", "asdf"); argument.IsNotEqual("asdf").IsEqual("asdf").IsNotNull(); // Act & Assert. Ensure.ArgumentExceptionIsThrown( () => { argument.Throw(); }, "argument"); }
public void NotThrowAnyException_WhenArgumentHasNoMatches() { // Arrange. IValidatableArgument<int> validatableArgument = new ValidatableArgument<int>("validatableArgument", 3); validatableArgument.IsLessThan(2).IsGreaterThan(5); // Act & Assert. Ensure.NoExceptionIsThrown( () => { validatableArgument.Throw(); }); }
public void ThrowArgumentOutOfRangeException_WhenTheFirstMatchingValidationRuleIsRangeRule() { // Arrange. IValidatableArgument <int> argument = new ValidatableArgument <int>("argument", 5); argument.IsEqual(3).IsLessThan(10); // Act & Assert. Ensure.ArgumentOutOfRangeExceptionIsThrown( () => { argument.Throw(); }, "argument"); }
public void ThrowArgumentException_WhenTheFirstMachingValidationRuleIsEqual() { // Arrange. IValidatableArgument <string> argument = new ValidatableArgument <string>("argument", "asdf"); argument.IsNotEqual("asdf").IsEqual("asdf").IsNotNull(); // Act & Assert. Ensure.ArgumentExceptionIsThrown( () => { argument.Throw(); }, "argument"); }
public void NotThrowAnyException_WhenArgumentHasNoMatches() { // Arrange. IValidatableArgument <int> validatableArgument = new ValidatableArgument <int>("validatableArgument", 3); validatableArgument.IsLessThan(2).IsGreaterThan(5); // Act & Assert. Ensure.NoExceptionIsThrown( () => { validatableArgument.Throw(); }); }