private static void TestCosmosElementVisitability(string filename)
        {
            ReadOnlyMemory <byte> payload = LazyCosmosElementTests.GetPayload(filename);

            CosmosElement cosmosElement = CosmosElement.CreateFromBuffer(payload);

            IJsonWriter jsonWriterIndexer    = Microsoft.Azure.Cosmos.Json.JsonWriter.Create(JsonSerializationFormat.Binary);
            IJsonWriter jsonWriterEnumerable = Microsoft.Azure.Cosmos.Json.JsonWriter.Create(JsonSerializationFormat.Binary);

            LazyCosmosElementTests.VisitCosmosElementIndexer(cosmosElement, jsonWriterIndexer);
            LazyCosmosElementTests.VisitCosmosElementEnumerable(cosmosElement, jsonWriterEnumerable);

            ReadOnlySpan <byte> payloadIndexer    = jsonWriterIndexer.GetResult().Span;
            ReadOnlySpan <byte> payloadEnumerable = jsonWriterEnumerable.GetResult().Span;

            Assert.IsTrue(payload.Span.SequenceEqual(payloadIndexer));
            Assert.IsTrue(payload.Span.SequenceEqual(payloadEnumerable));
        }
        private static void TestCosmosElementVisitabilityFromJson(string json)
        {
            ReadOnlyMemory <byte> payload = LazyCosmosElementTests.ConvertStringToBinary(json);

            CosmosElement cosmosElement = CosmosElement.CreateFromBuffer(payload);

            IJsonWriter jsonWriterIndexer    = Microsoft.Azure.Cosmos.Json.JsonWriter.Create(JsonSerializationFormat.Binary);
            IJsonWriter jsonWriterEnumerable = Microsoft.Azure.Cosmos.Json.JsonWriter.Create(JsonSerializationFormat.Binary);

            LazyCosmosElementTests.VisitCosmosElementIndexer(cosmosElement, jsonWriterIndexer);
            LazyCosmosElementTests.VisitCosmosElementEnumerable(cosmosElement, jsonWriterEnumerable);

            CosmosElement cosmosElementFromIndexer    = CosmosElement.CreateFromBuffer(jsonWriterIndexer.GetResult());
            CosmosElement cosmosElementFromEnumerable = CosmosElement.CreateFromBuffer(jsonWriterEnumerable.GetResult());

            Assert.AreEqual(cosmosElement, cosmosElementFromIndexer);
            Assert.AreEqual(cosmosElement, cosmosElementFromEnumerable);
        }