public async Task TestSearch() { ViziVault vault = new ViziVault(new Uri(baseUrl)).WithApiKey(apiKey).WithDecryptionKey(decryptionKey).WithEncryptionKey(encryptionKey); // Create two attributes AttributeDefinition attributeDef1 = new AttributeDefinition("TestAttribute1") { Indexed = true }; AttributeDefinition attributeDef2 = new AttributeDefinition("TestAttribute2"); await vault.StoreAttributeDefinitionAsync(attributeDef1); await vault.StoreAttributeDefinitionAsync(attributeDef2); User user1 = new User("user1"); user1.AddAttribute(attributeDef1.Name, "common first name"); User user2 = new User("user2"); user2.AddAttribute(attributeDef1.Name, "common first name"); user2.AddAttribute(attributeDef2.Name, "user2's last name"); try { await vault.SaveAsync(user1); await vault.SaveAsync(user2); SearchRequest searchRequest = new SearchRequest(); searchRequest.AddValueQuery(attributeDef1.Name, "common first name"); searchRequest.Attributes = new List <string> { attributeDef2.Name }; List <AttributeValue> results = await vault.SearchAsync(searchRequest, 0, 10); Assert.Equal(3, results.Count); Assert.Contains(results, (result) => attributeDef1.Name.Equals(result.AttributeKey) && user1.Id.Equals(result.UserId) ); Assert.Contains(results, (result) => attributeDef1.Name.Equals(result.AttributeKey) && user2.Id.Equals(result.UserId) ); Assert.Contains(results, (result) => attributeDef2.Name.Equals(result.AttributeKey) && user2.Id.Equals(result.UserId) ); } finally { await vault.PurgeAsync(user1.Id); await vault.PurgeAsync(user2.Id); } }