static Dictionary <string, string> ConvertStringToDictionary(string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                return(new Dictionary <string, string>());
            }

            return(ObjectSerializer.DeSerialize <Dictionary <string, string> >(data));
        }
Пример #2
0
        public object insertTodoItem(object param)
        {
            var item     = param as byte[];
            var todoItem = ObjectSerializer.DeSerialize(item, typeof(TodoItem));

            todoItem = this.insertTodoItem(item);

            return(todoItem.Serialize()); // ObjectSerialize.Serialize(todoItem);
        }
        public void Test_compatibility_with_Newtonsoft()
        {
            var serializerSettings = new JsonSerializerSettings
            {
                TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
                TypeNameHandling = TypeNameHandling.Auto,
                Converters       =
                {
                    new IsoDateTimeConverter
                    {
                        DateTimeStyles = DateTimeStyles.RoundtripKind
                    }
                }
            };

            var headersDeserialized = ObjectSerializer.DeSerialize <Dictionary <string, string> >(JsonConvert.SerializeObject(Expected, Formatting.None, serializerSettings));

            CollectionAssert.AreEquivalent(Expected, headersDeserialized);
        }
        public void Should_deserialized_header_be_the_same()
        {
            var headersDeserialized = ObjectSerializer.DeSerialize <Dictionary <string, string> >(ObjectSerializer.Serialize(Expected));

            CollectionAssert.AreEquivalent(Expected, headersDeserialized);
        }