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