public void Should_serialize_dynamic_object(Type type, object value)
        {
            SkipUnsupportedDataType(type, value);

            var dynamicObject = new DynamicObjectMapper().MapObject(value);

            var config = CreateModelFor(type);
            var copy   = dynamicObject.Clone(config);

            copy?.Get().ShouldBe(dynamicObject?.Get(), $"type: {type} value: {value}");

            var c = new DynamicObjectMapper().Map(copy);

            c.ShouldBe(value);
        }
        public void Should_serialize_dynamic_object_collection(Type type, IEnumerable value)
        {
            SkipUnsupportedDataType(type, value);

            var dynamicObjects = new DynamicObjectMapper(new DynamicObjectMapperSettings {
                WrapNullAsDynamicObject = true
            }).MapCollection(value);

            var config = CreateModelFor(type);
            var copy   = dynamicObjects.Clone(config);

            var dynamicObjectsCount = dynamicObjects?.Count() ?? 0;
            var copyCount           = copy?.Count() ?? 0;

            copyCount.ShouldBe(dynamicObjectsCount);

            for (int i = 0; i < copyCount; i++)
            {
                var originalValue = dynamicObjects.ElementAt(i)?.Get();
                var copyValue     = copy.ElementAt(i)?.Get();
                copyValue.ShouldBe(originalValue);
            }

            var c = new DynamicObjectMapper().Map(copy);

            if (value is null)
            {
                c.ShouldBeNull();
            }
            else
            {
                var array     = value.Cast <object>().ToArray();
                var copyArray = c.Cast <object>().ToArray();

                for (int i = 0; i < copyArray.Length; i++)
                {
                    copyArray[i].ShouldBe(array[i]);
                }
            }
        }