public void TestParameterIsNullPasses(string parameterName, DateTime?parameterValue, NullableDateTimeValidator validatorBase) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter is null" .x(() => validatorBase.IsNull().OtherwiseThrowException()); "Should not result in an exception" .x(() => validatorBase.CurrentException.Should().BeNull()); }
public void TestParameterIsNullFails(string parameterName, DateTime?parameterValue, NullableDateTimeValidator validatorBase, Action act) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter is null" .x(() => act = () => validatorBase.IsNull().OtherwiseThrowException()); "Should throw an exception" .x(() => act.ShouldThrow <ArgumentNullException>() .WithMessage(string.Format(Resources.MustBeNull + "\r\nParameter name: {0}", parameterName))); }