public void OnlyImageAttribute_ShouldValidateIfTheFileIsImage(string fileName, bool expectedResult) { var stream = FileHelpers.ReadFile(fileName); var attributeToTest = new AllowImageOnlyAttribute(); Assert.AreEqual(expectedResult, attributeToTest.IsValid(stream)); }
public void OnlyImageAttribute_ShouldReturnReturnFalseIfOneOfFilesIsNotImage() { var fileNames = new[] { "test.png", "test.jpg", "test.bmp", "test.exe" }; var files = FileHelpers.ReadFiles(fileNames); var attrebuteToTest = new AllowImageOnlyAttribute(); Assert.IsFalse(attrebuteToTest.IsValid(files)); }
public void OnlyImageAttribute_ShouldValidateMultupleFilesIfTheyAreImages() { var fileNames = new[] { "test.png", "test.jpg", "test.bmp" }; var files = FileHelpers.ReadFiles(fileNames); var attrebuteToTest = new AllowImageOnlyAttribute(); Assert.IsTrue(attrebuteToTest.IsValid(files)); }