public void IncorrectUseOfValidationOnAttributes() { var attribs = new ArgumentValidationAttribute[] { new MustExistAttribute(PathExists.AsFile), new MustNotExistAttribute() }; foreach (var attrib in attribs) { Action tryValidateWithNullContext = () => attrib.TryValidate(null, 0, out string reason); tryValidateWithNullContext.ShouldThrow <ArgumentNullException>("because {0} shouldn't let it", attrib.GetType().Name); } }
public void IncorrectUseOfAcceptTypeOnAttributes() { var attribs = new ArgumentValidationAttribute[] { new MustExistAttribute(PathExists.AsFile), new MustNotBeEmptyAttribute() }; foreach (var attrib in attribs) { Action acceptTypeWithNull = () => attrib.AcceptsType(null); acceptTypeWithNull.ShouldThrow <ArgumentNullException>(); } }