public void GetCosmosSerializerWithWrapperOrDefaultTest()
        {
            CosmosJsonDotNetSerializer serializer = new CosmosJsonDotNetSerializer();
            CosmosClientOptions        options    = new CosmosClientOptions()
            {
                Serializer = serializer
            };

            CosmosSerializer cosmosSerializer = options.GetCosmosSerializerWithWrapperOrDefault();

            Assert.AreNotEqual(cosmosSerializer, options.PropertiesSerializer, "Serializer should be custom not the default");
            Assert.AreNotEqual(cosmosSerializer, serializer, "Serializer should be in the CosmosJsonSerializerWrapper");

            CosmosJsonSerializerWrapper cosmosJsonSerializerWrapper = cosmosSerializer as CosmosJsonSerializerWrapper;

            Assert.IsNotNull(cosmosJsonSerializerWrapper);
            Assert.AreEqual(cosmosJsonSerializerWrapper.InternalJsonSerializer, serializer);
        }
        public void GetCosmosSerializerWithWrapperOrDefaultWithOptionsTest()
        {
            CosmosSerializationOptions serializerOptions = new CosmosSerializationOptions();

            Assert.IsFalse(serializerOptions.IgnoreNullValues);
            Assert.IsFalse(serializerOptions.Indented);
            Assert.AreEqual(CosmosPropertyNamingPolicy.Default, serializerOptions.PropertyNamingPolicy);

            CosmosClientOptions options = new CosmosClientOptions()
            {
                SerializerOptions = new CosmosSerializationOptions()
                {
                    IgnoreNullValues     = true,
                    Indented             = true,
                    PropertyNamingPolicy = CosmosPropertyNamingPolicy.CamelCase
                }
            };

            CosmosSerializer cosmosSerializer = options.GetCosmosSerializerWithWrapperOrDefault();

            Assert.AreNotEqual(cosmosSerializer, options.PropertiesSerializer, "Serializer should be custom not the default");

            CosmosJsonSerializerWrapper cosmosJsonSerializerWrapper = cosmosSerializer as CosmosJsonSerializerWrapper;

            Assert.IsNotNull(cosmosJsonSerializerWrapper);

            // Verify the custom settings are being honored
            dynamic testItem = new { id = "testid", description = (string)null, CamelCaseProperty = "TestCamelCase" };

            using (Stream stream = cosmosSerializer.ToStream <dynamic>(testItem))
            {
                using (StreamReader sr = new StreamReader(stream))
                {
                    string jsonString = sr.ReadToEnd();
                    // Notice description is not included, camelCaseProperty starts lower case, the white space shows the indents
                    string expectedJsonString = $"{{{Environment.NewLine}  \"id\": \"testid\",{Environment.NewLine}  \"camelCaseProperty\": \"TestCamelCase\"{Environment.NewLine}}}";
                    Assert.AreEqual(expectedJsonString, jsonString);
                }
            }
        }