private void ValidateCustomHeaders(CosmosMessageHeadersInternal internalHeaders) { string customHeaderValue = internalHeaders.Get("x-ms-cosmos-database-rid"); if (!string.IsNullOrEmpty(customHeaderValue)) { Assert.AreEqual("databaseRidValue", customHeaderValue); } }
private void ValidateLazyHeadersAreNotCreated(CosmosMessageHeadersInternal internalHeaders) { StoreRequestNameValueCollection storeRequestHeaders = (StoreRequestNameValueCollection)internalHeaders; FieldInfo lazyHeaders = typeof(StoreRequestNameValueCollection).GetField("lazyNotCommonHeaders", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); Lazy <Dictionary <string, string> > lazyNotCommonHeaders = (Lazy <Dictionary <string, string> >)lazyHeaders.GetValue(storeRequestHeaders); // Use the if instead of Assert.IsFalse to avoid creating the dictionary in the error message if (lazyNotCommonHeaders.IsValueCreated) { Assert.Fail($"The lazy dictionary should not be created. Please add the following headers to the {nameof(StoreRequestNameValueCollection)}: {JsonConvert.SerializeObject(lazyNotCommonHeaders.Value)}"); } }