public void Validate_should_be_invalid_if_no_file_uploaded()
        {
            page.PageOfAnswers = new List <PageOfAnswers>();

            var validator = new FileUploadRequiredValidator(config, page, null);

            var result = validator.Validate();

            result.IsValid.Should().BeFalse();
            result.QuestionId.Should().Be(questionId);
            result.ErrorMessage.Should().Be(config.ErrorMessage);
        }
        public void Validate_should_be_valid_if_a_file_is_being_uploaded()
        {
            var files = new FormFileCollection();

            files.Add(CreateFile(questionId, 1024));

            var validator = new FileUploadRequiredValidator(config, page, files);

            var result = validator.Validate();

            result.IsValid.Should().BeTrue();
            result.ErrorMessage.Should().BeNull();
        }
        public void Validate_should_be_valid_if_a_fileupload_already_Exists()
        {
            page.PageOfAnswers = new List <PageOfAnswers> {
                new PageOfAnswers {
                    Answers = new List <Answer> {
                        new Answer {
                            QuestionId = questionId
                        }
                    }
                }
            };

            var validator = new FileUploadRequiredValidator(config, page, null);

            var result = validator.Validate();

            result.IsValid.Should().BeTrue();
            result.ErrorMessage.Should().BeNull();
        }