public static void TestPurgeInactive() { TypeMap.Register.New <ILauncher>(() => new FakeLauncher()); ProcessState ps = new ProcessState(); ActiveFile activeFile1 = new ActiveFile(New <IDataStore>(@"C:\encrypted.axx"), New <IDataStore>(@"C:\decrypted.txt"), new LogOnIdentity("passphrase"), ActiveFileStatus.NotDecrypted, new V1Aes128CryptoFactory().CryptoId); ILauncher launcher1 = New <ILauncher>(); launcher1.Launch(activeFile1.EncryptedFileInfo.FullName); ps.Add(launcher1, activeFile1); Assert.That(ps.HasActiveProcess(activeFile1), Is.True); FakeLauncher fakeLauncher1 = (FakeLauncher)launcher1; fakeLauncher1.HasExited = true; Assert.That(ps.HasActiveProcess(activeFile1), Is.False); fakeLauncher1.HasExited = false; Assert.That(ps.HasActiveProcess(activeFile1), Is.True); fakeLauncher1.HasExited = true; Assert.That(ps.HasActiveProcess(activeFile1), Is.False); ActiveFile activeFile2 = new ActiveFile(New <IDataStore>(@"C:\encrypted2.axx"), New <IDataStore>(@"C:\decrypted2.txt"), new LogOnIdentity("passphrase"), ActiveFileStatus.NotDecrypted, new V1Aes128CryptoFactory().CryptoId); ILauncher launcher2 = New <ILauncher>(); launcher2.Launch(activeFile2.EncryptedFileInfo.FullName); ps.Add(launcher2, activeFile2); Assert.That(ps.HasActiveProcess(activeFile1), Is.False); fakeLauncher1.HasExited = false; Assert.That(ps.HasActiveProcess(activeFile1), Is.False); }