public async Task EncryptionCreateItem() { TestDoc testDoc = await EncryptionTests.CreateItemAsync(EncryptionTests.containerCore, EncryptionTests.dekId, TestDoc.PathsToEncrypt); await EncryptionTests.VerifyItemByReadAsync(EncryptionTests.containerCore, testDoc); await EncryptionTests.VerifyItemByReadStreamAsync(EncryptionTests.containerCore, testDoc); TestDoc expectedDoc = new TestDoc(testDoc); await EncryptionTests.ValidateQueryResultsAsync( EncryptionTests.containerCore, "SELECT * FROM c", expectedDoc); await EncryptionTests.ValidateQueryResultsAsync( EncryptionTests.containerCore, string.Format( "SELECT * FROM c where c.PK = '{0}' and c.id = '{1}' and c.NonSensitive = '{2}'", expectedDoc.PK, expectedDoc.Id, expectedDoc.NonSensitive), expectedDoc); await EncryptionTests.ValidateQueryResultsAsync( EncryptionTests.containerCore, string.Format("SELECT * FROM c where c.Sensitive = '{0}'", testDoc.Sensitive), expectedDoc : null); await EncryptionTests.ValidateQueryResultsAsync( EncryptionTests.containerCore, queryDefinition : new QueryDefinition( "select * from c where c.id = @theId and c.PK = @thePK") .WithParameter("@theId", expectedDoc.Id) .WithParameter("@thePK", expectedDoc.PK), expectedDoc : expectedDoc); expectedDoc.Sensitive = null; await EncryptionTests.ValidateQueryResultsAsync( EncryptionTests.containerCore, "SELECT c.id, c.PK, c.Sensitive, c.NonSensitive FROM c", expectedDoc); await EncryptionTests.ValidateQueryResultsAsync( EncryptionTests.containerCore, "SELECT c.id, c.PK, c.NonSensitive FROM c", expectedDoc); await EncryptionTests.ValidateSprocResultsAsync( EncryptionTests.containerCore, expectedDoc); }
public async Task DecryptQueryResultMultipleEncryptedPropertiesTest() { TestDoc testDoc = await EncryptionTests.CreateItemAsync( EncryptionTests.containerCore, EncryptionTests.dekId, new List <string>(){ "/Sensitive", "/NonSensitive" }); TestDoc expectedDoc = new TestDoc(testDoc); await EncryptionTests.ValidateQueryResultsAsync( EncryptionTests.containerCore, "SELECT * FROM c", expectedDoc); }