-Tests
This commit is contained in:
@@ -9563,25 +9563,6 @@ Path '', line 1, position 1.");
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET20 || PORTABLE || PORTABLE40)
|
|
||||||
[Test]
|
|
||||||
public void DeserializeDictionaryOfHashSetsWithTypeNameHandlingAll()
|
|
||||||
{
|
|
||||||
var dictionary = new Dictionary<int, HashSet<string>>
|
|
||||||
{
|
|
||||||
{ 1, new HashSet<string>(new[] { "test" }) },
|
|
||||||
};
|
|
||||||
|
|
||||||
var jsonSerializerSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
|
|
||||||
|
|
||||||
var obtainedJson = JsonConvert.SerializeObject(dictionary, jsonSerializerSettings);
|
|
||||||
|
|
||||||
var obtainedDictionary = (Dictionary<int, HashSet<string>>)JsonConvert.DeserializeObject(obtainedJson, jsonSerializerSettings);
|
|
||||||
|
|
||||||
Assert.IsNotNull(obtainedDictionary);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !(NETFX_CORE || DNXCORE50)
|
#if !(NETFX_CORE || DNXCORE50)
|
||||||
[Test]
|
[Test]
|
||||||
public void MailMessageConverterTest()
|
public void MailMessageConverterTest()
|
||||||
|
|||||||
@@ -1892,12 +1892,14 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !(NET20 || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void DeserializeDictionary()
|
public void DeserializeComplexGenericDictionary_Simple()
|
||||||
{
|
{
|
||||||
JsonSerializerSettings serializerSettings = new JsonSerializerSettings
|
JsonSerializerSettings serializerSettings = new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
TypeNameHandling = TypeNameHandling.All
|
TypeNameHandling = TypeNameHandling.All,
|
||||||
|
TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple
|
||||||
};
|
};
|
||||||
|
|
||||||
Dictionary<int, HashSet<string>> dictionary = new Dictionary<int, HashSet<string>>
|
Dictionary<int, HashSet<string>> dictionary = new Dictionary<int, HashSet<string>>
|
||||||
@@ -1911,6 +1913,28 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
|
|
||||||
Assert.IsNotNull(obtainedDictionary);
|
Assert.IsNotNull(obtainedDictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void DeserializeComplexGenericDictionary_Full()
|
||||||
|
{
|
||||||
|
JsonSerializerSettings serializerSettings = new JsonSerializerSettings
|
||||||
|
{
|
||||||
|
TypeNameHandling = TypeNameHandling.All,
|
||||||
|
TypeNameAssemblyFormat = FormatterAssemblyStyle.Full
|
||||||
|
};
|
||||||
|
|
||||||
|
Dictionary<int, HashSet<string>> dictionary = new Dictionary<int, HashSet<string>>
|
||||||
|
{
|
||||||
|
{ 1, new HashSet<string>(new[] { "test" }) },
|
||||||
|
};
|
||||||
|
|
||||||
|
string obtainedJson = JsonConvert.SerializeObject(dictionary, serializerSettings);
|
||||||
|
|
||||||
|
Dictionary<int, HashSet<string>> obtainedDictionary = (Dictionary<int, HashSet<string>>)JsonConvert.DeserializeObject(obtainedJson, serializerSettings);
|
||||||
|
|
||||||
|
Assert.IsNotNull(obtainedDictionary);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DataType
|
public class DataType
|
||||||
@@ -2183,5 +2207,4 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user