コード例 #1
0
        public async Task TestEncryptFilesUniqueWithBackupAndWipeWithCollision()
        {
            IDataStore sourceFileInfo = New <IDataStore>(_davidCopperfieldTxtPath);

            sourceFileInfo.Container.CreateFolder();
            IDataContainer sourceFolderInfo = sourceFileInfo.Container;

            sourceFolderInfo.CreateNewFile("David Copperfield-txt.axx");
            IDataStore alternateDestinationFileInfo = sourceFolderInfo.FileItemInfo("David Copperfield-txt.1.axx");

            Assert.That(alternateDestinationFileInfo.IsAvailable, Is.False, "The destination should not be created and exist yet.");

            EncryptionParameters encryptionParameters = new EncryptionParameters(new V2Aes128CryptoFactory().CryptoId, new Passphrase("allan"));

            await New <AxCryptFile>().EncryptFoldersUniqueWithBackupAndWipeAsync(new IDataContainer[] { sourceFolderInfo }, encryptionParameters, new ProgressContext());

            Assert.That(sourceFileInfo.IsAvailable, Is.False, "The source should be wiped.");

            Assert.That(alternateDestinationFileInfo.IsAvailable, Is.True, "The destination should be created and exist now.");
        }