public void HasExtension() { // Type var file1 = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DirectoryInfo_GetDirectoryName", "CreateDirectory.txt")); var file2 = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DirectoryInfo_GetDirectoryName", "CreateDirectory")); // Examples bool result1 = file1.HasExtension(); // return true; bool result2 = file2.HasExtension(); // return false; // Unit Test Assert.IsTrue(result1); Assert.IsFalse(result2); }
public bool TestDocumentType(FileInfo fileInfo) { return fileInfo != null && (fileInfo.HasExtension("htm") || fileInfo.HasExtension("html")); }
public bool TestDocumentType(FileInfo fileInfo) { return fileInfo != null && fileInfo.HasExtension("elaobj"); }