public void TestEncrypt() { var tempLongPathFilename = new StringBuilder(longPathDirectory).Append(@"\").Append("filename.ext").ToString(); try { using (var s = File.Create(tempLongPathFilename, 200)) { } var preAttrib = File.GetAttributes(tempLongPathFilename); Assert.AreEqual((FileAttributes)0, (preAttrib & FileAttributes.Encrypted)); File.Encrypt(tempLongPathFilename); var postAttrib = File.GetAttributes(tempLongPathFilename); Assert.AreEqual(FileAttributes.Encrypted, (postAttrib & FileAttributes.Encrypted)); } finally { File.Delete(tempLongPathFilename); } }
public static void Encrypt(string path) { File.Encrypt(path); }
public void TestEncryptNonExistentFile() { var tempLongPathFilename = new StringBuilder(longPathDirectory).Append(@"\").Append(Path.GetRandomFileName()).ToString(); Assert.Throws <FileNotFoundException>(() => File.Encrypt(tempLongPathFilename)); }
public void TestEncryptNonExistentFile() { var tempLongPathFilename = new StringBuilder(longPathDirectory).Append(@"\").Append(Path.GetRandomFileName()).ToString(); File.Encrypt(tempLongPathFilename); }