Пример #1
0
        public void ValidateReturnsExpectedResultWhenRequiredFileMissing(ZipArchive archive, ZipArchiveProblems expected)
        {
            using (archive)
            {
                var sut = new ZipArchiveValidator(Encoding.UTF8);

                var result = sut.Validate(archive);

                Assert.Equal(expected, result);
            }
        }
Пример #2
0
        public void ValidateReturnsExpectedResultFromEntryValidators()
        {
            using (var archive = CreateArchiveWithEmptyFiles())
            {
                var sut = new ZipArchiveValidator(Encoding.UTF8);

                var result = sut.Validate(archive);

                Assert.Equal(
                    ZipArchiveProblems.Many(
                        archive.Entries.Select(entry => entry.Name.EndsWith(".SHP") ? entry.HasNoShapeRecords() : entry.HasNoDbaseRecords(false))
                        ),
                    result);
            }
        }
Пример #3
0
        public void ValidateArchiveCanNotBeNull()
        {
            var sut = new ZipArchiveValidator(Encoding.UTF8);

            Assert.Throws <ArgumentNullException>(() => sut.Validate(null));
        }
Пример #4
0
        public void IsZipArchiveValidator()
        {
            var sut = new ZipArchiveValidator(Encoding.UTF8);

            Assert.IsAssignableFrom <IZipArchiveValidator>(sut);
        }