public void TestParameterNotNullOrEmptyPasses(string parameterName, string parameterValue, StringValidator validatorBase) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter is not null or empty" .x(() => validatorBase.IsNotNullOrEmpty().OtherwiseThrowException()); "Should not result in an exception" .x(() => validatorBase.CurrentException.Should().BeNull()); }
public void TestParameterNotNullOrEmptyFailsEmpty(string parameterName, string parameterValue, StringValidator validatorBase, Action act) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter is not null or empty" .x(() => act = () => validatorBase.IsNotNullOrEmpty().OtherwiseThrowException()); "Should throw an exception" .x(() => act.ShouldThrow <ArgumentException>() .WithMessage(string.Format(Resources.MustNotBeEmpty + "\r\nParameter name: {0}", parameterName))); }