public void TestDecrypt() { 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)); var fi = new FileInfo(tempLongPathFilename); fi.Encrypt(); var postAttrib = File.GetAttributes(tempLongPathFilename); Assert.AreEqual(FileAttributes.Encrypted, (postAttrib & FileAttributes.Encrypted)); fi.Decrypt(); postAttrib = File.GetAttributes(tempLongPathFilename); Assert.AreEqual((FileAttributes)0, (postAttrib & FileAttributes.Encrypted)); } finally { File.Delete(tempLongPathFilename); } }