Beispiel #1
0
        public void SubmittedFileTypeIsNullOrEmpty_IsInvalid(string allowedFileType, string submittedFileType)
        {
            var httpPostedFile = new StubbedHttpPostedFile(submittedFileType);
            var httpPostedFileValidationAttribute = new HttpPostedFileTypeAttribute(allowedFileType);

            Assert.False(httpPostedFileValidationAttribute.IsValid(httpPostedFile));
        }
Beispiel #2
0
        public void NoAllowedFileTypes_AnySubmittedFileTypeIsInvalid(string submittedFileType)
        {
            var httpPostedFile = new StubbedHttpPostedFile(submittedFileType);
            var httpPostedFileValidationAttribute = new HttpPostedFileTypeAttribute();

            Assert.False(httpPostedFileValidationAttribute.IsValid(httpPostedFile));
        }
Beispiel #3
0
        public void CasesOfFileTypesDoNotMatch_IsValid(string allowedFileType, string submittedFileType)
        {
            var httpPostedFile = new StubbedHttpPostedFile(submittedFileType);
            var httpPostedFileValidationAttribute = new HttpPostedFileTypeAttribute(allowedFileType);

            Assert.True(httpPostedFileValidationAttribute.IsValid(httpPostedFile));
        }
Beispiel #4
0
        public void HttpPostedFileIsNull_IsInvalid()
        {
            var httpPostedFileValidationAttribute = new HttpPostedFileTypeAttribute("text/xml");

            Assert.False(httpPostedFileValidationAttribute.IsValid(null));
        }