Exemple #1
0
        public void CanConvertPlainDictionary()
        {
            var dictionary = new ADictionary();

            dictionary.Add("First", new bool[] { true });
            dictionary.Add("Second", new bool[] { true, false });
            dictionary.Add("Third", new bool[] { false, false });
            var str = _serializer.Serialize(dictionary);

            Console.WriteLine(dictionary.GetType());
            var inters = dictionary.GetType().GetInterfaces();

            Console.WriteLine((typeof(IDictionary).IsAssignableFrom(dictionary.GetType())));

            foreach (var type in inters)
            {
                if (type.IsGenericType)
                {
                    Console.WriteLine(type.GetGenericTypeDefinition());
                    Console.WriteLine((typeof(IDictionary <,>)) == type.GetGenericTypeDefinition());
                }
            }

            var deserialized = _deserializer.Deserialize <ADictionary>(str);

            Assert.AreEqual(dictionary, deserialized);
        }