public void NullFileTest() { var attributeValidator = new AllowedContentTypeAttribute(allowedContentType); var validResult = attributeValidator.IsValid(null); Assert.False(validResult); }
public void InjectAnotherTypeTest() { var anotherObject = "hello"; var attributeValidator = new AllowedContentTypeAttribute(allowedContentType); var validResult = attributeValidator.IsValid(anotherObject); Assert.False(validResult); }
public void InvalidContentTypeTest(string fileNameTest) { var fileMock = new Mock <IFormFile>(); fileMock.Setup(x => x.ContentType).Returns(fileNameTest); var attributeValidator = new AllowedContentTypeAttribute(allowedContentType); var fileObject = fileMock.Object; var validResult = attributeValidator.IsValid(fileObject); Assert.False(validResult); }