Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public void NoAllowedFileTypes_AnySubmittedFileTypeIsInvalid(string submittedFileType)
        {
            var httpPostedFile = new StubbedHttpPostedFile(submittedFileType);
            var httpPostedFileValidationAttribute = new HttpPostedFileTypeAttribute();

            Assert.False(httpPostedFileValidationAttribute.IsValid(httpPostedFile));
        }
Exemplo n.º 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));
        }
Exemplo n.º 4
0
        public void HttpPostedFileIsNull_IsInvalid()
        {
            var httpPostedFileValidationAttribute = new HttpPostedFileTypeAttribute("text/xml");

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