예제 #1
0
        public void validate_should_return_false_if_extension_is_empty()
        {
            const string EXTENSION_TO_VALIDATE = "";

            _validate.ValidExtensions = new[] { ".pdf" };
            _validate.IsValid(EXTENSION_TO_VALIDATE).Should().BeFalse();
        }
예제 #2
0
        public bool IsFileValid(string validExtension, HttpPostedFileBase file)
        {
            var validateFile = new ValidateFile()
            {
                ValidExtensions = new String[1] {
                    validExtension
                }
            };

            if (validateFile.IsValid(file))
            {
                return(true);
            }

            errorMessage = WebMessage.ErrorMessage.INVALID_FILE_FORMAT + validExtension;
            return(false);
        }