public void WhenParameterIsEmpty_ThrowsException() { //ARRANGE string temp = string.Empty; var stringValidator = new StringValidatorWithValue(() => temp, temp); //ACT TestDelegate testDelegate = stringValidator.Validate; //ASSERT var exeption = Assert.Throws<ArgumentNullException>(testDelegate); Assert.AreEqual("temp", exeption.ParamName); }
public void WhenPredicateIsSpecifiedAndIsTrue_ValidateToTrue() { //ARRANGE var temp = "Data"; var stringValidator = new StringValidatorWithValue(() => temp, temp, parameterToCheck => true); //ACT stringValidator.Validate(); //ASSERT }
public void WhenPredicateIsSpecifiedAndIsFalse_ThrowsException() { //ARRANGE var temp = "Data"; var stringValidator = new StringValidatorWithValue(() => temp, temp, parameterToCheck => false); //ACT TestDelegate testDelegate = stringValidator.Validate; //ASSERT Assert.Throws<ArgumentOutOfRangeException>(testDelegate); }
public void WhenPredicateIsSpecifiedAndIsTrueAndValueIsEmpty_ThrowsException() { //ARRANGE var temp = string.Empty; var stringValidator = new StringValidatorWithValue(() => temp, temp, parameterToCheck => true); //ACT TestDelegate testDelegate = stringValidator.Validate; //ASSERT Assert.Throws<ArgumentNullException>(testDelegate); }
public void WhenParameterIsNotNullAndNotEmpty_DoesNotThrowException() { //ARRANGE const string temp = "hello"; var stringValidator= new StringValidatorWithValue(() => temp, temp); //ACT stringValidator.Validate(); //ASSERT }