public void TestParameterInheritsTypePasses(string parameterName, Person parameterValue, ClassValidator <Person> validatorBase, Action act) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter inherits from type Person" .x(() => validatorBase.InheritsType(typeof(Person)).OtherwiseThrowException()); "Should not result in an exception" .x(() => validatorBase.CurrentException.Should().BeNull()); }
public void TestParameterInheritsTypeFailsDueToNullType(string parameterName, Person parameterValue, ClassValidator <Person> validatorBase, Action act) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter inherits from type Officer" .x(() => act = () => validatorBase.InheritsType(null).OtherwiseThrowException()); "Should throw an exception" .x(() => act.ShouldThrow <ArgumentNullException>() .WithMessage("Value cannot be null.\r\nParameter name: type")); }
public void TestParameterInheritsTypeFailsDueToNullValue(string parameterName, Person parameterValue, ClassValidator <Person> validatorBase, Action act) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter inherits from type Officer" .x(() => act = () => validatorBase.InheritsType(typeof(Person)).OtherwiseThrowException()); "Should throw an exception" .x(() => act.ShouldThrow <ArgumentNullException>() .WithMessage(string.Format(Resources.MustNotBeNull + "\r\nParameter name: {0}", parameterName))); }