public static void TestUpdateActiveFileWithKeyIfKeyMatchesThumbprintWithKnownKey() { IRuntimeFileInfo encryptedFileInfo = OS.Current.FileInfo(_encryptedFile1); IRuntimeFileInfo decryptedFileInfo = OS.Current.FileInfo(_decryptedFile1); AesKey key = new AesKey(); ActiveFile activeFile = new ActiveFile(encryptedFileInfo, decryptedFileInfo, key, ActiveFileStatus.AssumedOpenAndDecrypted | ActiveFileStatus.NotShareable, null); _fileSystemState.Add(activeFile); bool updateWasMade = _fileSystemState.UpdateActiveFileWithKeyIfKeyMatchesThumbprint(key); Assert.That(updateWasMade, Is.False, "Since there are only ActiveFiles with known keys in the list, no update should be made."); }
public static void TestUpdateActiveFileWithKeyIfKeyMatchesThumbprintWithMatchingThumbprint() { IRuntimeFileInfo encryptedFileInfo = OS.Current.FileInfo(_encryptedFile1); IRuntimeFileInfo decryptedFileInfo = OS.Current.FileInfo(_decryptedFile1); AesKey key = new AesKey(); ActiveFile activeFile = new ActiveFile(encryptedFileInfo, decryptedFileInfo, key, ActiveFileStatus.AssumedOpenAndDecrypted | ActiveFileStatus.NotShareable, null); _fileSystemState.Add(activeFile); _fileSystemState.Save(); _fileSystemState.Dispose(); _fileSystemState = new FileSystemState(); _fileSystemState.Load(OS.Current.FileInfo(_fileSystemStateFilePath)); bool updateWasMade = _fileSystemState.UpdateActiveFileWithKeyIfKeyMatchesThumbprint(key); Assert.That(updateWasMade, Is.True, "Since there is an ActiveFile with the right thumbprint in the list, an update should be made."); }