public async Task RotatingKeyEncryptor_EncryptDecrypt() { _decryptStore.Clear(); _encryptStore.Clear(); var encryptor = CreateEncryptor(); var cipherText = await encryptor.Encrypt("bob"); Assert.IsFalse(string.IsNullOrWhiteSpace(cipherText)); Assert.AreNotEqual("bob", cipherText); var decrypted = await encryptor.Decrypt(cipherText); Assert.AreEqual("bob", decrypted); Assert.AreEqual(1, (await _decryptStore.Find("*.*")).Count()); Assert.AreEqual(1, (await _encryptStore.Find("*.*")).Count()); }
private static void FilterDuplicates(MemoryStore store) { var statements = store .Select(new Statement(null, null, null)) .GroupBy(statement => new { Subject = statement.Subject.Uri, Predicate = statement.Predicate.Uri }) .Select(group => group.First()) .ToArray(); store.Clear(); foreach (var statement in statements) { store.Add(statement); } Console.WriteLine("Filtered to {0} statements.", store.StatementCount); }