public void SubmittedFileTypeIsNullOrEmpty_IsInvalid(string allowedFileType, string submittedFileType) { var httpPostedFile = new StubbedHttpPostedFile(submittedFileType); var httpPostedFileValidationAttribute = new HttpPostedFileTypeAttribute(allowedFileType); Assert.False(httpPostedFileValidationAttribute.IsValid(httpPostedFile)); }
public void NoAllowedFileTypes_AnySubmittedFileTypeIsInvalid(string submittedFileType) { var httpPostedFile = new StubbedHttpPostedFile(submittedFileType); var httpPostedFileValidationAttribute = new HttpPostedFileTypeAttribute(); Assert.False(httpPostedFileValidationAttribute.IsValid(httpPostedFile)); }
public void CasesOfFileTypesDoNotMatch_IsValid(string allowedFileType, string submittedFileType) { var httpPostedFile = new StubbedHttpPostedFile(submittedFileType); var httpPostedFileValidationAttribute = new HttpPostedFileTypeAttribute(allowedFileType); Assert.True(httpPostedFileValidationAttribute.IsValid(httpPostedFile)); }
public void HttpPostedFileIsNull_IsInvalid() { var httpPostedFileValidationAttribute = new HttpPostedFileTypeAttribute("text/xml"); Assert.False(httpPostedFileValidationAttribute.IsValid(null)); }