Beispiel #1
0
        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));
                File.Encrypt(tempLongPathFilename);
                var postAttrib = File.GetAttributes(tempLongPathFilename);
                Assert.AreEqual(FileAttributes.Encrypted, (postAttrib & FileAttributes.Encrypted));
                File.Decrypt(tempLongPathFilename);
                postAttrib = File.GetAttributes(tempLongPathFilename);
                Assert.AreEqual((FileAttributes)0, (postAttrib & FileAttributes.Encrypted));
            }
            finally
            {
                File.Delete(tempLongPathFilename);
            }
        }
Beispiel #2
0
 public static void Decrypt(string path)
 {
     File.Decrypt(path);
 }
Beispiel #3
0
        public void TestDecryptNonExistentFile()
        {
            var tempLongPathFilename = new StringBuilder(longPathDirectory).Append(@"\").Append(Path.GetRandomFileName()).ToString();

            Assert.Throws <FileNotFoundException>(() => File.Decrypt(tempLongPathFilename));
        }
Beispiel #4
0
        public void TestDecryptNonExistentFile()
        {
            var tempLongPathFilename = new StringBuilder(longPathDirectory).Append(@"\").Append(Path.GetRandomFileName()).ToString();

            File.Decrypt(tempLongPathFilename);
        }