public void OnlyArchiveAttribute_ShouldReturnValidateIfTheFileIsArchive(string fileName, bool expectedResult) { var stream = FileHelpers.ReadFile(fileName); var attributeToTest = new AllowArchiveOnlyAttribute(); Assert.AreEqual(expectedResult, attributeToTest.IsValid(stream)); }
public void AllowArchiveOnlyAttribute_ShouldReturnFalseIfOneOfTheFilesIsNotArchive() { var fileNames = new[] { "test.zip", "test.7z", "test.jpg", "test.gz" }; var files = FileHelpers.ReadFiles(fileNames); var attributeToTest = new AllowArchiveOnlyAttribute(); Assert.IsFalse(attributeToTest.IsValid(files)); }
public void AllowArchiveOnlyAttribute_ShouldCanValidateMultipleFiles() { var fileNames = new[] { "test.zip", "test.7z", "test.bz2", "test.gz" }; var files = FileHelpers.ReadFiles(fileNames); var attributeToTest = new AllowArchiveOnlyAttribute(); Assert.IsTrue(attributeToTest.IsValid(files)); }
public void AllowArchiveOnlyAttribute_ShouldReturnTrueIfInputIsNull() { var attributeToTest = new AllowArchiveOnlyAttribute(); Assert.IsTrue(attributeToTest.IsValid(null)); }