public void ValidFilenameAttributeTest() { ValidFilenameAttribute attribute = new ValidFilenameAttribute(16); const string validFileName = "c:\\test\\test.txt"; const string invalidFileName = "c:\\te%@$#s><t**est.>txt"; const string longinvalidFileName = "c:\\te%@$#gfdsgfdhytueytjuegrhrthjetrgshstest.>txt"; Assert.IsTrue(attribute.IsValid(validFileName)); Assert.IsFalse(attribute.IsValid(invalidFileName)); Assert.IsFalse(attribute.IsValid(longinvalidFileName)); }
public void VetaExportRequest_FilenameUnSuccessful( Guid projectUid, FilterResult filter, string fileName, CoordType coordType, OutputTypes outputType, string[] machineNames) { var userPreferences = new UserPreferences(); var request = new CompactionVetaExportRequest( projectUid, filter, fileName, coordType, outputType, userPreferences, machineNames, null, null); var validate = new ValidFilenameAttribute(256); var result = validate.IsValid(request.FileName); Assert.False(result); }